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