2020-02-21 17:01:26 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-06-27 21:19:49 -07:00
|
|
|
#include "GPSStatus.h"
|
|
|
|
|
#include "NodeStatus.h"
|
2020-10-10 09:57:57 +08:00
|
|
|
#include "PowerStatus.h"
|
2023-03-08 19:13:46 -08:00
|
|
|
#include "detect/ScanI2C.h"
|
2020-10-10 09:57:57 +08:00
|
|
|
#include "graphics/Screen.h"
|
2023-02-17 12:31:51 +01:00
|
|
|
#include "memGet.h"
|
2023-03-08 19:13:46 -08:00
|
|
|
#include "mesh/generated/meshtastic/config.pb.h"
|
2023-01-18 08:56:47 -06:00
|
|
|
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
2023-05-08 13:18:28 +02:00
|
|
|
#include <SPI.h>
|
2023-01-18 14:51:48 -06:00
|
|
|
#include <map>
|
2022-11-24 12:24:57 +01:00
|
|
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
2022-10-13 12:55:28 +02:00
|
|
|
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
2022-10-13 13:01:24 +02:00
|
|
|
#endif
|
2023-02-03 08:50:10 -06:00
|
|
|
#if defined(ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
|
|
|
|
#include "nimble/NimbleBluetooth.h"
|
|
|
|
|
extern NimbleBluetooth *nimbleBluetooth;
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef ARCH_NRF52
|
|
|
|
|
#include "NRF52Bluetooth.h"
|
|
|
|
|
extern NRF52Bluetooth *nrf52Bluetooth;
|
|
|
|
|
#endif
|
2020-03-15 16:47:38 -07:00
|
|
|
|
2024-04-17 14:25:52 -05:00
|
|
|
#if ARCH_PORTDUINO
|
|
|
|
|
extern HardwareSPI *DisplaySPI;
|
|
|
|
|
extern HardwareSPI *LoraSPI;
|
|
|
|
|
|
|
|
|
|
#endif
|
2023-03-08 19:13:46 -08:00
|
|
|
extern ScanI2C::DeviceAddress screen_found;
|
|
|
|
|
extern ScanI2C::DeviceAddress cardkb_found;
|
2022-05-09 20:12:49 +02:00
|
|
|
extern uint8_t kb_model;
|
2023-03-08 19:13:46 -08:00
|
|
|
extern ScanI2C::DeviceAddress rtc_found;
|
2023-03-23 11:32:04 -05:00
|
|
|
extern ScanI2C::DeviceAddress accelerometer_found;
|
2023-05-06 07:17:40 -05:00
|
|
|
extern ScanI2C::FoundDevice rgb_found;
|
2022-03-28 16:55:58 +02:00
|
|
|
|
2022-04-25 07:13:41 +02:00
|
|
|
extern bool eink_found;
|
2022-09-08 10:32:12 +08:00
|
|
|
extern bool pmu_found;
|
2020-02-24 11:21:08 -08:00
|
|
|
extern bool isCharging;
|
2020-03-15 16:47:38 -07:00
|
|
|
extern bool isUSBPowered;
|
|
|
|
|
|
2022-11-24 12:24:57 +01:00
|
|
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
2022-10-13 12:55:28 +02:00
|
|
|
extern ATECCX08A atecc;
|
2022-10-13 13:01:24 +02:00
|
|
|
#endif
|
2022-10-13 12:55:28 +02:00
|
|
|
|
2023-07-22 09:26:54 -05:00
|
|
|
#ifdef T_WATCH_S3
|
|
|
|
|
#include <Adafruit_DRV2605.h>
|
|
|
|
|
extern Adafruit_DRV2605 drv;
|
|
|
|
|
#endif
|
2023-12-12 08:36:37 -06:00
|
|
|
|
|
|
|
|
#ifdef HAS_I2S
|
|
|
|
|
#include "AudioThread.h"
|
|
|
|
|
extern AudioThread *audioThread;
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-06-11 17:47:45 -05:00
|
|
|
// Global Screen singleton.
|
|
|
|
|
extern graphics::Screen *screen;
|
|
|
|
|
|
2024-09-25 21:25:31 +10:00
|
|
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
|
|
|
|
#include "motion/AccelerometerThread.h"
|
2024-05-16 17:27:36 -05:00
|
|
|
extern AccelerometerThread *accelerometerThread;
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-07-22 09:26:54 -05:00
|
|
|
extern bool isVibrating;
|
|
|
|
|
|
2022-10-01 12:02:29 +02:00
|
|
|
extern int TCPPort; // set by Portduino
|
|
|
|
|
|
2020-04-10 12:18:48 -07:00
|
|
|
// Return a human readable string of the form "Meshtastic_ab13"
|
|
|
|
|
const char *getDeviceName();
|
2020-04-23 16:55:25 -07:00
|
|
|
|
2022-03-01 18:40:21 +00:00
|
|
|
extern uint32_t timeLastPowered;
|
|
|
|
|
|
2021-03-27 10:19:59 +08:00
|
|
|
extern uint32_t rebootAtMsec;
|
2022-01-21 15:03:26 -06:00
|
|
|
extern uint32_t shutdownAtMsec;
|
2021-03-27 10:19:59 +08:00
|
|
|
|
2022-04-02 16:02:26 +02:00
|
|
|
extern uint32_t serialSinceMsec;
|
|
|
|
|
|
2021-03-28 12:16:37 +08:00
|
|
|
// If a thread does something that might need for it to be rescheduled ASAP it can set this flag
|
2023-07-14 17:25:20 -04:00
|
|
|
// This will suppress the current delay and instead try to run ASAP.
|
2021-03-28 12:16:37 +08:00
|
|
|
extern bool runASAP;
|
|
|
|
|
|
2024-06-22 07:00:48 -05:00
|
|
|
extern bool pauseBluetoothLogging;
|
|
|
|
|
|
2023-12-27 14:26:40 -06:00
|
|
|
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearBonds(), enterDfuMode();
|
2023-02-16 12:18:27 -06:00
|
|
|
|
|
|
|
|
meshtastic_DeviceMetadata getDeviceMetadata();
|
2023-05-08 13:18:28 +02:00
|
|
|
|
2024-08-11 20:06:38 +08:00
|
|
|
// We default to 4MHz SPI, SPI mode 0
|
2024-09-25 21:25:31 +10:00
|
|
|
extern SPISettings spiSettings;
|