Update boards.cpp

This commit is contained in:
lewisxhe 2025-10-13 09:54:39 +08:00
commit 53169538bd
98 changed files with 2450 additions and 2205 deletions

View file

@ -16,7 +16,7 @@
#include <SD.h>
#endif
#if defined(ARDUINO_ARCH_ESP32)
#if defined(ARDUINO_ARCH_ESP32)
#include <FS.h>
#include <WiFi.h>
#endif
@ -24,30 +24,18 @@
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#ifdef DISPLAY_MODEL
#include <U8g2lib.h>
#endif
#ifdef HAS_PMU
#include <XPowersLib.h>
#endif
#include <esp_mac.h>
#ifndef DISPLAY_MODEL
#define DISPLAY_MODEL U8G2_SSD1306_128X64_NONAME_F_HW_I2C
#endif
#ifndef OLED_WIRE_PORT
#define OLED_WIRE_PORT Wire
#endif
#ifndef PMU_WIRE_PORT
#define PMU_WIRE_PORT Wire
#endif
#ifndef DISPLAY_ADDR
#define DISPLAY_ADDR 0x3C
#endif
#ifndef LORA_FREQ_CONFIG
#define LORA_FREQ_CONFIG 915.0
#endif
// #define ENABLE_BLE //Enable ble function
enum {
POWERMANAGE_ONLINE = _BV(0),
@ -67,7 +55,6 @@ enum {
};
#define ENABLE_BLE //Enable ble function
typedef struct {
String chipModel;
@ -81,17 +68,24 @@ typedef struct {
void setupBoards(bool disable_u8g2 = false);
#ifdef HAS_SDCARD
bool beginSDCard();
#else
#define beginSDCard()
#endif
#ifdef DISPLAY_ADDR
bool beginDisplay();
#endif
void disablePeripherals();
bool beginPower();
void printResult(bool radio_online);
#ifdef BOARD_LED
void flashLed();
#else
#define flashLed()
#endif
void scanDevices(TwoWire *w);
@ -99,18 +93,23 @@ bool beginGPS();
bool recoveryGPS();
void loopPMU(void (*pressed_cb)(void));
void scanWiFi();
#ifdef HAS_PMU
extern XPowersLibInterface *PMU;
extern bool pmuInterrupt;
void loopPMU(void (*pressed_cb)(void));
bool beginPower();
void disablePeripherals();
#else
#define beginPower()
#endif
extern DISPLAY_MODEL *u8g2;
#ifdef DISPLAY_MODEL
extern DISPLAY_MODEL *u8g2;
#define U8G2_HOR_ALIGN_CENTER(t) ((u8g2->getDisplayWidth() - (u8g2->getUTF8Width(t))) / 2)
#define U8G2_HOR_ALIGN_RIGHT(t) ( u8g2->getDisplayWidth() - u8g2->getUTF8Width(t))
#endif
#if defined(ARDUINO_ARCH_ESP32)
@ -124,8 +123,12 @@ extern SPIClass SDCardSPI;
extern HardwareSerial SerialGPS;
#endif
#ifdef HAS_NTC
float getTempForNTC();
#endif
#ifdef ENABLE_BLE
void setupBLE();
#endif
extern uint32_t deviceOnline;