mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Merge branch 'master' into ble_output_gpwpl
This commit is contained in:
commit
c612254099
@ -1,6 +1,6 @@
|
|||||||
version: 0.1
|
version: 0.1
|
||||||
cli:
|
cli:
|
||||||
version: 1.22.15
|
version: 1.24.0
|
||||||
plugins:
|
plugins:
|
||||||
sources:
|
sources:
|
||||||
- id: trunk
|
- id: trunk
|
||||||
@ -9,7 +9,7 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.435
|
- checkov@3.2.435
|
||||||
- renovate@40.32.7
|
- renovate@40.33.8
|
||||||
- prettier@3.5.3
|
- prettier@3.5.3
|
||||||
- trufflehog@3.88.34
|
- trufflehog@3.88.34
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
|
54
boards/seeed_wio_tracker_L1.json
Normal file
54
boards/seeed_wio_tracker_L1.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "nrf52840_s140_v7.ld"
|
||||||
|
},
|
||||||
|
"core": "nRF5",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
||||||
|
"f_cpu": "64000000L",
|
||||||
|
"hwids": [["0x2886", "0x1668"]],
|
||||||
|
"usb_product": "TRACKER L1",
|
||||||
|
"mcu": "nrf52840",
|
||||||
|
"variant": "seeed_wio_tracker_L1",
|
||||||
|
"bsp": {
|
||||||
|
"name": "adafruit"
|
||||||
|
},
|
||||||
|
"softdevice": {
|
||||||
|
"sd_flags": "-DS140",
|
||||||
|
"sd_name": "s140",
|
||||||
|
"sd_version": "7.3.0",
|
||||||
|
"sd_fwid": "0x0123"
|
||||||
|
},
|
||||||
|
"bootloader": {
|
||||||
|
"settings_addr": "0xFF000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connectivity": ["bluetooth"],
|
||||||
|
"debug": {
|
||||||
|
"jlink_device": "nRF52840_xxAA",
|
||||||
|
"svd_path": "nrf52840.svd",
|
||||||
|
"openocd_target": "nrf52840-mdk-rs"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "seeed_wio_tracker_L1",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 248832,
|
||||||
|
"maximum_size": 815104,
|
||||||
|
"speed": 115200,
|
||||||
|
"protocol": "nrfutil",
|
||||||
|
"protocols": [
|
||||||
|
"jlink",
|
||||||
|
"nrfjprog",
|
||||||
|
"nrfutil",
|
||||||
|
"stlink",
|
||||||
|
"cmsis-dap",
|
||||||
|
"blackmagic"
|
||||||
|
],
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true
|
||||||
|
},
|
||||||
|
"url": "https://www.seeedstudio.com/Wio-Tracker-L1-p-6477.html",
|
||||||
|
"vendor": "Seeed Studio"
|
||||||
|
}
|
@ -108,7 +108,7 @@ lib_deps =
|
|||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
||||||
https://github.com/meshtastic/device-ui/archive/e63b219e78e9655be10745b4037cefd2c608d258.zip
|
https://github.com/meshtastic/device-ui/archive/3dfcc973cdfec8b34719510952e160bbfb57d9df.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
@ -161,6 +161,8 @@ lib_deps =
|
|||||||
sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
|
sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
|
||||||
# renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
|
# renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
|
||||||
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2
|
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit LTR390 Library packageName=adafruit/library/Adafruit LTR390 Library
|
||||||
|
adafruit/Adafruit LTR390 Library@1.1.2
|
||||||
# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/Adafruit PCT2075
|
# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/Adafruit PCT2075
|
||||||
adafruit/Adafruit PCT2075@1.0.5
|
adafruit/Adafruit PCT2075@1.0.5
|
||||||
|
|
||||||
@ -190,4 +192,4 @@ lib_deps =
|
|||||||
# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
|
# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
|
||||||
boschsensortec/BME68x Sensor Library@1.3.40408
|
boschsensortec/BME68x Sensor Library@1.3.40408
|
||||||
# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
|
||||||
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
@ -99,8 +99,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// OLED & Input
|
// OLED & Input
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
#if defined(SEEED_WIO_TRACKER_L1)
|
||||||
|
#define SSD1306_ADDRESS 0x3D
|
||||||
|
#define USE_SH1106
|
||||||
|
#else
|
||||||
#define SSD1306_ADDRESS 0x3C
|
#define SSD1306_ADDRESS 0x3C
|
||||||
|
#endif
|
||||||
#define ST7567_ADDRESS 0x3F
|
#define ST7567_ADDRESS 0x3F
|
||||||
|
|
||||||
// The SH1106 controller is almost, but not quite, the same as SSD1306
|
// The SH1106 controller is almost, but not quite, the same as SSD1306
|
||||||
|
@ -174,7 +174,7 @@ bool EInkDisplay::connect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \
|
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
|
||||||
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
|
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
|
||||||
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
|
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
|
||||||
{
|
{
|
||||||
@ -228,6 +228,68 @@ bool EInkDisplay::connect()
|
|||||||
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1);
|
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1);
|
||||||
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
|
|
||||||
|
// Init GxEPD2
|
||||||
|
adafruitDisplay->init();
|
||||||
|
adafruitDisplay->setRotation(3);
|
||||||
|
}
|
||||||
|
#elif defined(HELTEC_WIRELESS_PAPER)
|
||||||
|
{
|
||||||
|
uint8_t model;
|
||||||
|
pinMode(PIN_EINK_SCLK, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_DC, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_CS, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_RES, OUTPUT);
|
||||||
|
|
||||||
|
//rest e-ink
|
||||||
|
digitalWrite(PIN_EINK_RES, LOW);
|
||||||
|
delay(20);
|
||||||
|
digitalWrite(PIN_EINK_RES, HIGH);
|
||||||
|
delay(20);
|
||||||
|
|
||||||
|
digitalWrite(PIN_EINK_DC, LOW);
|
||||||
|
digitalWrite(PIN_EINK_CS, LOW);
|
||||||
|
|
||||||
|
// write cmd
|
||||||
|
uint8_t cmd = 0x2F;
|
||||||
|
pinMode(PIN_EINK_MOSI, OUTPUT);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW);
|
||||||
|
cmd <<= 1;
|
||||||
|
digitalWrite(PIN_EINK_SCLK, HIGH);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
}
|
||||||
|
delay(10);
|
||||||
|
|
||||||
|
digitalWrite(PIN_EINK_DC, HIGH);
|
||||||
|
pinMode(PIN_EINK_MOSI, INPUT_PULLUP);
|
||||||
|
|
||||||
|
// read chip ID
|
||||||
|
uint8_t chipId = 0;
|
||||||
|
for (int8_t b = 7; b >= 0; b--)
|
||||||
|
{
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, HIGH);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b);
|
||||||
|
}
|
||||||
|
digitalWrite(PIN_EINK_CS, HIGH);
|
||||||
|
LOG_INFO("eink chipId: %02X", chipId);
|
||||||
|
model = ((chipId&0x03) !=0x01) ? 1 : 2;
|
||||||
|
|
||||||
|
// Start HSPI
|
||||||
|
hspi = new SPIClass(HSPI);
|
||||||
|
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS
|
||||||
|
// VExt already enabled in setup()
|
||||||
|
// RTC GPIO hold disabled in setup()
|
||||||
|
|
||||||
|
// Create GxEPD2 objects
|
||||||
|
adafruitDisplay = new EInkMultiWrapper<EINK_DISPLAY_MODEL1, EINK_DISPLAY_MODEL2>(model, PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *hspi);
|
||||||
|
|
||||||
// Init GxEPD2
|
// Init GxEPD2
|
||||||
adafruitDisplay->init();
|
adafruitDisplay->init();
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "GxEPD2_BW.h"
|
#include "GxEPD2_BW.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
#include "EinkMultiWrapper.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation.
|
* An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation.
|
||||||
@ -64,8 +65,11 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
virtual bool connect() override;
|
virtual bool connect() override;
|
||||||
|
|
||||||
// AdafruitGFX display object - instantiated in connect(), variant specific
|
// AdafruitGFX display object - instantiated in connect(), variant specific
|
||||||
|
#if defined(HELTEC_WIRELESS_PAPER)
|
||||||
|
EInkMultiWrapper<EINK_DISPLAY_MODEL1, EINK_DISPLAY_MODEL2> *adafruitDisplay;
|
||||||
|
#else
|
||||||
GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT> *adafruitDisplay = NULL;
|
GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT> *adafruitDisplay = NULL;
|
||||||
|
#endif
|
||||||
// If display uses HSPI
|
// If display uses HSPI
|
||||||
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
|
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
|
||||||
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
|
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
|
||||||
|
327
src/graphics/EInkMultiWrapper.h
Normal file
327
src/graphics/EInkMultiWrapper.h
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
// Wrapper class for GxEPD2_BW
|
||||||
|
|
||||||
|
// Generic signature at build time, allowing display model to be detected at run-time
|
||||||
|
// Workaround for issue of GxEPD2_BW objects not having a shared base class
|
||||||
|
// Only exposes methods which we are actually using
|
||||||
|
#ifndef _EINKMULTIWRAPPER_H_
|
||||||
|
#define _EINKMULTIWRAPPER_H_
|
||||||
|
|
||||||
|
#include "GxEPD2_BW.h"
|
||||||
|
#include "GxEPD2_EPD.h"
|
||||||
|
|
||||||
|
template <typename DISPLAY_MODEL_1, typename DISPLAY_MODEL_2>
|
||||||
|
class EInkMultiWrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void drawPixel(int16_t x, int16_t y, uint16_t color)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawPixel(x, y, color);
|
||||||
|
else
|
||||||
|
model2->drawPixel(x, y, color);
|
||||||
|
}
|
||||||
|
void init(uint32_t serial_diag_bitrate = 0) // = 0 : disabled
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->init(serial_diag_bitrate);
|
||||||
|
else
|
||||||
|
model2->init(serial_diag_bitrate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
|
||||||
|
else
|
||||||
|
model2->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
|
||||||
|
}
|
||||||
|
void fillScreen(uint16_t color) // 0x0 black, >0x0 white, to buffer
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->fillScreen(color);
|
||||||
|
else
|
||||||
|
model2->fillScreen(color);
|
||||||
|
}
|
||||||
|
void display(bool partial_update_mode = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->display(partial_update_mode);
|
||||||
|
else
|
||||||
|
model2->display(partial_update_mode);
|
||||||
|
}
|
||||||
|
void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->displayWindow(x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->displayWindow(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFullWindow()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->setFullWindow();
|
||||||
|
else
|
||||||
|
model2->setFullWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->setPartialWindow(x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->setPartialWindow(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void firstPage()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->firstPage();
|
||||||
|
else
|
||||||
|
model2->firstPage();
|
||||||
|
}
|
||||||
|
void endAsyncFull()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->endAsyncFull();
|
||||||
|
else
|
||||||
|
model2->endAsyncFull();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nextPage()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
return model1->nextPage();
|
||||||
|
else
|
||||||
|
return model2->nextPage();
|
||||||
|
}
|
||||||
|
void drawPaged(void (*drawCallback)(const void*), const void* pv)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawPaged(drawCallback, pv);
|
||||||
|
else
|
||||||
|
model2->drawPaged(drawCallback, pv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawInvertedBitmap(x, y, bitmap, w, h, color);
|
||||||
|
else
|
||||||
|
model2->drawInvertedBitmap(x, y, bitmap, w, h, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearScreen(uint8_t value = 0xFF) // init controller memory and screen (default white)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->clearScreen(value);
|
||||||
|
else
|
||||||
|
model2->clearScreen(value);
|
||||||
|
}
|
||||||
|
void writeScreenBuffer(uint8_t value = 0xFF) // init controller memory (default white)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeScreenBuffer(value);
|
||||||
|
else
|
||||||
|
model2->writeScreenBuffer(value);
|
||||||
|
}
|
||||||
|
// write to controller memory, without screen refresh; x and w should be multiple of 8
|
||||||
|
void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->writeImagePart(x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImage(black, color, x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->writeImage(black, color, x, y, w, h);
|
||||||
|
}
|
||||||
|
void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->writeImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h);
|
||||||
|
}
|
||||||
|
// write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
|
||||||
|
void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
// write to controller memory, with screen refresh; x and w should be multiple of 8
|
||||||
|
void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->drawImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->drawImage(black, color, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImage(black, color, x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->drawImage(black, color, x, y, w, h);
|
||||||
|
}
|
||||||
|
void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->drawImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
|
||||||
|
int16_t x, int16_t y, int16_t w, int16_t h)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->drawImagePart( black, color, x_part, y_part, w_bitmap, h_bitmap,x, y, w, h);
|
||||||
|
}
|
||||||
|
// write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
|
||||||
|
void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
else
|
||||||
|
model2->drawNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
void refresh(bool partial_update_mode = false) // screen refresh from controller memory to full screen
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->refresh(partial_update_mode);
|
||||||
|
else
|
||||||
|
model2->refresh(partial_update_mode);
|
||||||
|
}
|
||||||
|
void refresh(int16_t x, int16_t y, int16_t w, int16_t h) // screen refresh from controller memory, partial screen
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->refresh(x, y, w, h);
|
||||||
|
else
|
||||||
|
model2->refresh(x, y, w, h);
|
||||||
|
}
|
||||||
|
// turns off generation of panel driving voltages, avoids screen fading over time
|
||||||
|
void powerOff()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->powerOff();
|
||||||
|
else
|
||||||
|
model2->powerOff();
|
||||||
|
}
|
||||||
|
// turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
|
||||||
|
void hibernate()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->hibernate();
|
||||||
|
else
|
||||||
|
model2->hibernate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRotation(uint8_t x)
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
model1->setRotation(x);
|
||||||
|
else
|
||||||
|
model2->setRotation(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t width()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
return model1->width();
|
||||||
|
else
|
||||||
|
return model2->width();
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t height()
|
||||||
|
{
|
||||||
|
if (model == 1)
|
||||||
|
return model1->height();
|
||||||
|
else
|
||||||
|
return model2->height();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Exposes methods of the GxEPD2_EPD object which is usually available as GxEPD2_BW::epd
|
||||||
|
class Epd2Wrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool isBusy() { return m_epd2->isBusy(); }
|
||||||
|
GxEPD2_EPD *m_epd2;
|
||||||
|
} epd2;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
// Select driver by passing whichModel as 1 or 2
|
||||||
|
EInkMultiWrapper(uint8_t whichModel, int16_t cs, int16_t dc, int16_t rst, int16_t busy, SPIClass &spi)
|
||||||
|
{
|
||||||
|
assert(whichModel == 1 || whichModel == 2);
|
||||||
|
model = whichModel;
|
||||||
|
// LOG_DEBUG("GxEPD2_BW_MultiWrapper using driver %d", model);
|
||||||
|
|
||||||
|
if (model == 1)
|
||||||
|
{
|
||||||
|
model1 = new GxEPD2_BW<DISPLAY_MODEL_1, DISPLAY_MODEL_1::HEIGHT>(DISPLAY_MODEL_1(cs, dc, rst, busy, spi));
|
||||||
|
epd2.m_epd2 = &(model1->epd2);
|
||||||
|
}
|
||||||
|
else if (model == 2)
|
||||||
|
{
|
||||||
|
model2 = new GxEPD2_BW<DISPLAY_MODEL_2, DISPLAY_MODEL_2::HEIGHT>(DISPLAY_MODEL_2(cs, dc, rst, busy, spi));
|
||||||
|
epd2.m_epd2 = &(model2->epd2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t model;
|
||||||
|
GxEPD2_BW<DISPLAY_MODEL_1, DISPLAY_MODEL_1::HEIGHT> *model1;
|
||||||
|
GxEPD2_BW<DISPLAY_MODEL_2, DISPLAY_MODEL_2::HEIGHT> *model2;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
126
src/graphics/niche/Drivers/EInk/E0213A367.cpp
Normal file
126
src/graphics/niche/Drivers/EInk/E0213A367.cpp
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
#include "./E0213A367.h"
|
||||||
|
|
||||||
|
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||||
|
|
||||||
|
using namespace NicheGraphics::Drivers;
|
||||||
|
|
||||||
|
// Map the display controller IC's output to the connected panel
|
||||||
|
void E0213A367::configScanning()
|
||||||
|
{
|
||||||
|
// "Driver output control"
|
||||||
|
sendCommand(0x01);
|
||||||
|
sendData(0xF9);
|
||||||
|
sendData(0x00);
|
||||||
|
// Values set here might be redundant: F9, 00 seems to be default
|
||||||
|
}
|
||||||
|
|
||||||
|
// Specify which information is used to control the sequence of voltages applied to move the pixels
|
||||||
|
// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from
|
||||||
|
// the controller IC's OTP memory, when the update procedure begins.
|
||||||
|
void E0213A367::configWaveform()
|
||||||
|
{
|
||||||
|
sendCommand(0x37); // Waveform ID register
|
||||||
|
sendData(0x40); // ByteA
|
||||||
|
sendData(0x80); // ByteB DM[7:0]
|
||||||
|
sendData(0x03); // ByteC DM[[15:8]
|
||||||
|
sendData(0x0E); // ByteD DM[[23:16]
|
||||||
|
|
||||||
|
switch (updateType) {
|
||||||
|
case FAST:
|
||||||
|
sendCommand(0x3C); // Border waveform:
|
||||||
|
sendData(0x81);
|
||||||
|
break;
|
||||||
|
case FULL:
|
||||||
|
sendCommand(0x3C); // Border waveform:
|
||||||
|
sendData(0x01);
|
||||||
|
default:
|
||||||
|
// From OTP memory
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void E0213A367::configUpdateSequence()
|
||||||
|
{
|
||||||
|
switch (updateType) {
|
||||||
|
case FAST:
|
||||||
|
sendCommand(0x22);
|
||||||
|
sendData(0xFF);
|
||||||
|
break;
|
||||||
|
case FULL:
|
||||||
|
default:
|
||||||
|
sendCommand(0x22); // Set "update sequence"
|
||||||
|
sendData(0xF7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once the refresh operation has been started,
|
||||||
|
// begin periodically polling the display to check for completion, using the normal Meshtastic threading code
|
||||||
|
// Only used when refresh is "async"
|
||||||
|
void E0213A367::detachFromUpdate()
|
||||||
|
{
|
||||||
|
switch (updateType) {
|
||||||
|
case FAST:
|
||||||
|
return beginPolling(50, 500); // At least 500ms for fast refresh
|
||||||
|
case FULL:
|
||||||
|
default:
|
||||||
|
return beginPolling(100, 2000); // At least 2 seconds for full refresh
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void E0213A367::configFullscreen()
|
||||||
|
{
|
||||||
|
// Placing this code in a separate method because it's probably pretty consistent between displays
|
||||||
|
// Should make it tidier to override SSD16XX::configure
|
||||||
|
|
||||||
|
// Define the boundaries of the "fullscreen" region, for the controller IC
|
||||||
|
static const uint16_t sx = bufferOffsetX; // Notice the offset
|
||||||
|
static const uint16_t sy = 0;
|
||||||
|
static const uint16_t ex = bufferRowSize + bufferOffsetX - 1; // End is "max index", not "count". Minus 1 handles this
|
||||||
|
static const uint16_t ey = height;
|
||||||
|
|
||||||
|
// Split into bytes
|
||||||
|
static const uint8_t sy1 = sy & 0xFF;
|
||||||
|
static const uint8_t ey1 = ey & 0xFF;
|
||||||
|
|
||||||
|
// Data entry mode - Left to Right, Top to Bottom
|
||||||
|
sendCommand(0x11);
|
||||||
|
sendData(0x03);
|
||||||
|
|
||||||
|
// Select controller IC memory region to display a fullscreen image
|
||||||
|
sendCommand(0x44); // Memory X start - end
|
||||||
|
sendData(sx);
|
||||||
|
sendData(ex);
|
||||||
|
sendCommand(0x45); // Memory Y start - end
|
||||||
|
sendData(sy1);
|
||||||
|
sendData(ey1);
|
||||||
|
|
||||||
|
// Place the cursor at the start of this memory region, ready to send image data x=0 y=0
|
||||||
|
sendCommand(0x4E); // Memory cursor X
|
||||||
|
sendData(sx);
|
||||||
|
sendCommand(0x4F); // Memory cursor y
|
||||||
|
sendData(sy1);
|
||||||
|
}
|
||||||
|
void E0213A367::finalizeUpdate()
|
||||||
|
{
|
||||||
|
// Put a copy of the image into the "old memory".
|
||||||
|
// Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place
|
||||||
|
// We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc.
|
||||||
|
if (updateType != FULL) {
|
||||||
|
writeNewImage(); // Only required by some controller variants. Todo: Override just for GDEY0154D678?
|
||||||
|
writeOldImage();
|
||||||
|
sendCommand(0x7F); // Terminate image write without update
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
//After waking up from sleep mode, the local refresh is abnormal, which may be due to the loss of data in RAM.
|
||||||
|
// if ((pin_rst != 0xFF) && (updateType ==FULL))
|
||||||
|
// deepSleep();
|
||||||
|
}
|
||||||
|
|
||||||
|
void E0213A367::deepSleep()
|
||||||
|
{
|
||||||
|
sendCommand(0x10); // Enter deep sleep
|
||||||
|
sendData(0x03); // Will not retain image RAM
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
44
src/graphics/niche/Drivers/EInk/E0213A367.h
Normal file
44
src/graphics/niche/Drivers/EInk/E0213A367.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
E-Ink display driver
|
||||||
|
- SSD1682
|
||||||
|
- Manufacturer: WISEVAST
|
||||||
|
- Size: 2.13 inch
|
||||||
|
- Resolution: 122px x 255px
|
||||||
|
- Flex connector marking: HINK-E0213A162-FPC-A0 (Hidden, printed on back-side)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#include "./SSD16XX.h"
|
||||||
|
|
||||||
|
namespace NicheGraphics::Drivers
|
||||||
|
{
|
||||||
|
class E0213A367 : public SSD16XX
|
||||||
|
{
|
||||||
|
// Display properties
|
||||||
|
private:
|
||||||
|
static constexpr uint32_t width = 122;
|
||||||
|
static constexpr uint32_t height = 250;
|
||||||
|
static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST);
|
||||||
|
|
||||||
|
public:
|
||||||
|
E0213A367() : SSD16XX(width, height, supported, 0) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void configScanning() override;
|
||||||
|
virtual void configWaveform() override;
|
||||||
|
virtual void configUpdateSequence() override;
|
||||||
|
virtual void detachFromUpdate() override;
|
||||||
|
virtual void configFullscreen() override;
|
||||||
|
virtual void deepSleep() override;
|
||||||
|
virtual void finalizeUpdate() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace NicheGraphics::Drivers
|
||||||
|
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
@ -111,9 +111,10 @@ void InkHUD::LogoApplet::onShutdown()
|
|||||||
|
|
||||||
// Prepare for the powered-off screen now
|
// Prepare for the powered-off screen now
|
||||||
// We can change these values because the initial "shutting down" screen has already rendered at this point
|
// We can change these values because the initial "shutting down" screen has already rendered at this point
|
||||||
|
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
textLeft = "";
|
textLeft = "";
|
||||||
textRight = "";
|
textRight = "";
|
||||||
textTitle = owner.short_name;
|
textTitle = parseShortName(ourNode);
|
||||||
fontTitle = fontLarge;
|
fontTitle = fontLarge;
|
||||||
|
|
||||||
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
|
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
|
||||||
|
@ -52,6 +52,13 @@ BMP280Sensor bmp280Sensor;
|
|||||||
NullSensor bme280Sensor;
|
NullSensor bme280Sensor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __has_include(<Adafruit_LTR390.h>)
|
||||||
|
#include "Sensor/LTR390UVSensor.h"
|
||||||
|
LTR390UVSensor ltr390uvSensor;
|
||||||
|
#else
|
||||||
|
NullSensor ltr390uvSensor;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __has_include(<bsec2.h>)
|
#if __has_include(<bsec2.h>)
|
||||||
#include "Sensor/BME680Sensor.h"
|
#include "Sensor/BME680Sensor.h"
|
||||||
BME680Sensor bme680Sensor;
|
BME680Sensor bme680Sensor;
|
||||||
@ -231,6 +238,8 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
#endif
|
#endif
|
||||||
if (bme280Sensor.hasSensor())
|
if (bme280Sensor.hasSensor())
|
||||||
result = bme280Sensor.runOnce();
|
result = bme280Sensor.runOnce();
|
||||||
|
if (ltr390uvSensor.hasSensor())
|
||||||
|
result = ltr390uvSensor.runOnce();
|
||||||
if (bmp3xxSensor.hasSensor())
|
if (bmp3xxSensor.hasSensor())
|
||||||
result = bmp3xxSensor.runOnce();
|
result = bmp3xxSensor.runOnce();
|
||||||
if (bme680Sensor.hasSensor())
|
if (bme680Sensor.hasSensor())
|
||||||
@ -524,6 +533,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m
|
|||||||
valid = valid && bme280Sensor.getMetrics(m);
|
valid = valid && bme280Sensor.getMetrics(m);
|
||||||
hasSensor = true;
|
hasSensor = true;
|
||||||
}
|
}
|
||||||
|
if (ltr390uvSensor.hasSensor()) {
|
||||||
|
valid = valid && ltr390uvSensor.getMetrics(m);
|
||||||
|
hasSensor = true;
|
||||||
|
}
|
||||||
if (bmp3xxSensor.hasSensor()) {
|
if (bmp3xxSensor.hasSensor()) {
|
||||||
valid = valid && bmp3xxSensor.getMetrics(m);
|
valid = valid && bmp3xxSensor.getMetrics(m);
|
||||||
hasSensor = true;
|
hasSensor = true;
|
||||||
@ -752,6 +765,11 @@ AdminMessageHandleResult EnvironmentTelemetryModule::handleAdminMessageForModule
|
|||||||
if (result != AdminMessageHandleResult::NOT_HANDLED)
|
if (result != AdminMessageHandleResult::NOT_HANDLED)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (ltr390uvSensor.hasSensor()) {
|
||||||
|
result = ltr390uvSensor.handleAdminMessage(mp, request, response);
|
||||||
|
if (result != AdminMessageHandleResult::NOT_HANDLED)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
if (bmp3xxSensor.hasSensor()) {
|
if (bmp3xxSensor.hasSensor()) {
|
||||||
result = bmp3xxSensor.handleAdminMessage(mp, request, response);
|
result = bmp3xxSensor.handleAdminMessage(mp, request, response);
|
||||||
if (result != AdminMessageHandleResult::NOT_HANDLED)
|
if (result != AdminMessageHandleResult::NOT_HANDLED)
|
||||||
|
73
src/modules/Telemetry/Sensor/LTR390UVSensor.cpp
Normal file
73
src/modules/Telemetry/Sensor/LTR390UVSensor.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include(<Adafruit_LTR390.h>)
|
||||||
|
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "LTR390UVSensor.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include <Adafruit_LTR390.h>
|
||||||
|
|
||||||
|
LTR390UVSensor::LTR390UVSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_LTR390UV, "LTR390UV") {}
|
||||||
|
|
||||||
|
int32_t LTR390UVSensor::runOnce()
|
||||||
|
{
|
||||||
|
LOG_INFO("Init sensor: %s", sensorName);
|
||||||
|
if (!hasSensor()) {
|
||||||
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = ltr390uv.begin(nodeTelemetrySensorsMap[sensorType].second);
|
||||||
|
ltr390uv.setMode(LTR390_MODE_UVS);
|
||||||
|
ltr390uv.setGain(LTR390_GAIN_18); // Datasheet default
|
||||||
|
ltr390uv.setResolution(LTR390_RESOLUTION_20BIT); // Datasheet default
|
||||||
|
|
||||||
|
return initI2CSensor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LTR390UVSensor::setup() {}
|
||||||
|
|
||||||
|
bool LTR390UVSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||||
|
{
|
||||||
|
LOG_DEBUG("LTR390UV getMetrics");
|
||||||
|
|
||||||
|
// Because the sensor does not measure Lux and UV at the same time, we need to read them in two passes.
|
||||||
|
if (ltr390uv.newDataAvailable()) {
|
||||||
|
measurement->variant.environment_metrics.has_lux = true;
|
||||||
|
measurement->variant.environment_metrics.has_uv_lux = true;
|
||||||
|
|
||||||
|
if (ltr390uv.getMode() == LTR390_MODE_ALS) {
|
||||||
|
lastLuxReading = 0.6 * ltr390uv.readALS() / (1 * 4); // Datasheet page 23 for gain x1 and 20bit resolution
|
||||||
|
LOG_DEBUG("LTR390UV Lux reading: %f", lastLuxReading);
|
||||||
|
|
||||||
|
measurement->variant.environment_metrics.lux = lastLuxReading;
|
||||||
|
measurement->variant.environment_metrics.uv_lux = lastUVReading;
|
||||||
|
|
||||||
|
ltr390uv.setGain(
|
||||||
|
LTR390_GAIN_18); // Recommended for UVI - x18. Do not change, 2300 UV Sensitivity only specified for x18 gain
|
||||||
|
ltr390uv.setMode(LTR390_MODE_UVS);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else if (ltr390uv.getMode() == LTR390_MODE_UVS) {
|
||||||
|
lastUVReading = ltr390uv.readUVS() /
|
||||||
|
2300.f; // Datasheet page 23 and page 6, only characterisation for gain x18 and 20bit resolution
|
||||||
|
LOG_DEBUG("LTR390UV UV reading: %f", lastUVReading);
|
||||||
|
|
||||||
|
measurement->variant.environment_metrics.lux = lastLuxReading;
|
||||||
|
measurement->variant.environment_metrics.uv_lux = lastUVReading;
|
||||||
|
|
||||||
|
ltr390uv.setGain(
|
||||||
|
LTR390_GAIN_1); // x1 gain will already max out the sensor at direct sunlight, so no need to increase it
|
||||||
|
ltr390uv.setMode(LTR390_MODE_ALS);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case we fail to read the sensor mode, set the has_lux and has_uv_lux back to false
|
||||||
|
measurement->variant.environment_metrics.has_lux = false;
|
||||||
|
measurement->variant.environment_metrics.has_uv_lux = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
25
src/modules/Telemetry/Sensor/LTR390UVSensor.h
Normal file
25
src/modules/Telemetry/Sensor/LTR390UVSensor.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include(<Adafruit_LTR390.h>)
|
||||||
|
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include <Adafruit_LTR390.h>
|
||||||
|
|
||||||
|
class LTR390UVSensor : public TelemetrySensor
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Adafruit_LTR390 ltr390uv = Adafruit_LTR390();
|
||||||
|
float lastLuxReading = 0;
|
||||||
|
float lastUVReading = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setup() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LTR390UVSensor();
|
||||||
|
virtual int32_t runOnce() override;
|
||||||
|
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -85,6 +85,8 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_SEEED_SOLAR_NODE
|
#define HW_VENDOR meshtastic_HardwareModel_SEEED_SOLAR_NODE
|
||||||
#elif defined(HELTEC_MESH_POCKET)
|
#elif defined(HELTEC_MESH_POCKET)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_POCKET
|
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_POCKET
|
||||||
|
#elif defined(SEEED_WIO_TRACKER_L1)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1
|
||||||
#else
|
#else
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN
|
#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,12 +19,58 @@
|
|||||||
// Shared NicheGraphics components
|
// Shared NicheGraphics components
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
|
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
|
||||||
|
#include "graphics/niche/Drivers/EInk/E0213A367.h"
|
||||||
#include "graphics/niche/Inputs/TwoButton.h"
|
#include "graphics/niche/Inputs/TwoButton.h"
|
||||||
|
|
||||||
void setupNicheGraphics()
|
void setupNicheGraphics()
|
||||||
{
|
{
|
||||||
using namespace NicheGraphics;
|
using namespace NicheGraphics;
|
||||||
|
|
||||||
|
pinMode(PIN_EINK_SCLK, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_DC, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_CS, OUTPUT);
|
||||||
|
pinMode(PIN_EINK_RES, OUTPUT);
|
||||||
|
|
||||||
|
//rest e-ink
|
||||||
|
digitalWrite(PIN_EINK_RES, LOW);
|
||||||
|
delay(20);
|
||||||
|
digitalWrite(PIN_EINK_RES, HIGH);
|
||||||
|
delay(20);
|
||||||
|
|
||||||
|
digitalWrite(PIN_EINK_DC, LOW);
|
||||||
|
digitalWrite(PIN_EINK_CS, LOW);
|
||||||
|
|
||||||
|
// write cmd
|
||||||
|
uint8_t cmd = 0x2F;
|
||||||
|
pinMode(PIN_EINK_MOSI, OUTPUT);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
digitalWrite(PIN_EINK_MOSI, (cmd & 0x80) ? HIGH : LOW);
|
||||||
|
cmd <<= 1;
|
||||||
|
digitalWrite(PIN_EINK_SCLK, HIGH);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
}
|
||||||
|
delay(10);
|
||||||
|
|
||||||
|
digitalWrite(PIN_EINK_DC, HIGH);
|
||||||
|
pinMode(PIN_EINK_MOSI, INPUT_PULLUP);
|
||||||
|
|
||||||
|
// read chip ID
|
||||||
|
uint8_t chipId = 0;
|
||||||
|
for (int8_t b = 7; b >= 0; b--)
|
||||||
|
{
|
||||||
|
digitalWrite(PIN_EINK_SCLK, LOW);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
digitalWrite(PIN_EINK_SCLK, HIGH);
|
||||||
|
delayMicroseconds(1);
|
||||||
|
if (digitalRead(PIN_EINK_MOSI)) chipId |= (1 << b);
|
||||||
|
}
|
||||||
|
digitalWrite(PIN_EINK_CS, HIGH);
|
||||||
|
LOG_INFO("eink chipId: %02X", chipId);
|
||||||
|
|
||||||
// SPI
|
// SPI
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
|
||||||
@ -34,8 +80,15 @@ void setupNicheGraphics()
|
|||||||
|
|
||||||
// E-Ink Driver
|
// E-Ink Driver
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
Drivers::EInk *driver;
|
||||||
Drivers::EInk *driver = new Drivers::LCMEN213EFC1;
|
if((chipId &0x03) !=0x01)
|
||||||
|
{
|
||||||
|
driver = new Drivers::LCMEN213EFC1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
driver = new Drivers::E0213A367;
|
||||||
|
}
|
||||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||||
|
|
||||||
// InkHUD
|
// InkHUD
|
||||||
|
@ -8,6 +8,8 @@ build_flags =
|
|||||||
-I variants/heltec_wireless_paper
|
-I variants/heltec_wireless_paper
|
||||||
-D HELTEC_WIRELESS_PAPER
|
-D HELTEC_WIRELESS_PAPER
|
||||||
-D EINK_DISPLAY_MODEL=GxEPD2_213_FC1
|
-D EINK_DISPLAY_MODEL=GxEPD2_213_FC1
|
||||||
|
-D EINK_DISPLAY_MODEL1=GxEPD2_213_FC1
|
||||||
|
-D EINK_DISPLAY_MODEL2=GxEPD2_213_E0213A367
|
||||||
-D EINK_WIDTH=250
|
-D EINK_WIDTH=250
|
||||||
-D EINK_HEIGHT=122
|
-D EINK_HEIGHT=122
|
||||||
-D USE_EINK
|
-D USE_EINK
|
||||||
@ -17,9 +19,9 @@ build_flags =
|
|||||||
-D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
|
-D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${esp32s3_base.lib_deps}
|
${esp32s3_base.lib_deps}
|
||||||
https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip
|
https://github.com/Quency-D/GxEPD2/archive/0513405847b281d9dea400488714643ef84507ec.zip
|
||||||
lewisxhe/PCF8563_Library@^1.0.1
|
lewisxhe/PCF8563_Library@^1.0.1
|
||||||
upload_speed = 115200
|
upload_speed = 921600
|
||||||
|
|
||||||
[env:heltec-wireless-paper-inkhud]
|
[env:heltec-wireless-paper-inkhud]
|
||||||
extends = esp32s3_base, inkhud
|
extends = esp32s3_base, inkhud
|
||||||
|
13
variants/seeed_wio_tracker_L1/platformio.ini
Normal file
13
variants/seeed_wio_tracker_L1/platformio.ini
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[env:seeed_wio_tracker_L1]
|
||||||
|
board = seeed_wio_tracker_L1
|
||||||
|
extends = nrf52840_base
|
||||||
|
;board_level = extra
|
||||||
|
build_flags = ${nrf52840_base.build_flags}
|
||||||
|
-I $PROJECT_DIR/variants/seeed_wio_tracker_L1
|
||||||
|
-D SEEED_WIO_TRACKER_L1
|
||||||
|
-Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52
|
||||||
|
board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld
|
||||||
|
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_wio_tracker_L1>
|
||||||
|
lib_deps =
|
||||||
|
${nrf52840_base.lib_deps}
|
||||||
|
debug_tool = jlink
|
96
variants/seeed_wio_tracker_L1/variant.cpp
Normal file
96
variants/seeed_wio_tracker_L1/variant.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* variant.cpp - Digital pin mapping for TRACKER L1
|
||||||
|
*
|
||||||
|
* This file defines the pin mapping array that maps logical digital pins (D0-D17)
|
||||||
|
* to physical GPIO ports/pins on the Nordic nRF52 series microcontroller.
|
||||||
|
*
|
||||||
|
* Board: [Seeed Studio WIO TRACKER L1]
|
||||||
|
* Hardware Features:
|
||||||
|
* - LoRa module (CS/SCK/MISO/MOSI control pins)
|
||||||
|
* - GNSS module (TX/RX/Reset/Wakeup)
|
||||||
|
* - User LEDs (D11-D12)
|
||||||
|
* - User button (D13)
|
||||||
|
* - Grove/NFC interface (D14-D15)
|
||||||
|
* - Battery voltage monitoring (D16)
|
||||||
|
*
|
||||||
|
* Created [20250521]
|
||||||
|
* By [Dylan]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "variant.h"
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "wiring_constants.h"
|
||||||
|
#include "wiring_digital.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Digital pin to GPIO port/pin mapping table
|
||||||
|
*
|
||||||
|
* Format: Logical Pin (Dx) -> nRF Port.Pin (Px.xx)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
const uint32_t g_ADigitalPinMap[] = {
|
||||||
|
// D0 .. D10 - Peripheral control pins
|
||||||
|
41, // D0 P1.09 GNSS_WAKEUP
|
||||||
|
7, // D1 P0.07 LORA_DIO1
|
||||||
|
39, // D2 P1,07 LORA_RESET
|
||||||
|
42, // D3 P1.10 LORA_BUSY
|
||||||
|
46, // D4 P1.14 (A4/SDA) LORA_CS
|
||||||
|
40, // D5 P1.08 (A5/SCL) LORA_SW
|
||||||
|
27, // D6 P0.27 (UART_TX) GNSS_TX
|
||||||
|
26, // D7 P0.26 (UART_RX) GNSS_RX
|
||||||
|
30, // D8 P0.30 (SPI_SCK) LORA_SCK
|
||||||
|
3, // D9 P0.3 (SPI_MISO) LORA_MISO
|
||||||
|
28, // D10 P0.28 (SPI_MOSI) LORA_MOSI
|
||||||
|
|
||||||
|
// D11-D12 - LED outputs
|
||||||
|
33, // D11 P1.1 User LED
|
||||||
|
// Buzzzer
|
||||||
|
32, // D12 P1.0 Buzzer
|
||||||
|
|
||||||
|
// D13 - User input
|
||||||
|
8, // D13 P0.08 User Button
|
||||||
|
|
||||||
|
// D14-D15 - Grove interface
|
||||||
|
6, // D14 P0.06 OLED SDA
|
||||||
|
5, // D15 P0.05 OLED SCL
|
||||||
|
|
||||||
|
// D16 - Battery voltage ADC input
|
||||||
|
31, // D16 P0.31 VBAT_ADC
|
||||||
|
// GROVE
|
||||||
|
0, // D17 P0.00 GROVESDA
|
||||||
|
1, // D18 P0.01 GROVESCL
|
||||||
|
|
||||||
|
// FLASH
|
||||||
|
21, // D19 P0.21 (QSPI_SCK)
|
||||||
|
25, // D20 P0.25 (QSPI_CSN)
|
||||||
|
20, // D21 P0.20 (QSPI_SIO_0 DI)
|
||||||
|
24, // D22 P0.24 (QSPI_SIO_1 DO)
|
||||||
|
22, // D23 P0.22 (QSPI_SIO_2 WP)
|
||||||
|
23, // D24 P0.23 (QSPI_SIO_3 HOLD)
|
||||||
|
|
||||||
|
36, // D25 TB_UP
|
||||||
|
12, // D26 TB_DOWN
|
||||||
|
11, // D27 TB_LEFT
|
||||||
|
35, // D28 TB_RIGHT
|
||||||
|
37, // D29 TB_PRESS
|
||||||
|
4, // D30 BAT_CTL
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
pinMode(PIN_QSPI_CS, OUTPUT);
|
||||||
|
digitalWrite(PIN_QSPI_CS, HIGH);
|
||||||
|
// This setup is crucial for ensuring low power consumption and proper initialization of the hardware components.
|
||||||
|
// VBAT_ENABLE
|
||||||
|
pinMode(BAT_READ, OUTPUT);
|
||||||
|
digitalWrite(BAT_READ, HIGH);
|
||||||
|
|
||||||
|
pinMode(PIN_LED1, OUTPUT);
|
||||||
|
digitalWrite(PIN_LED1, LOW);
|
||||||
|
pinMode(PIN_LED2, OUTPUT);
|
||||||
|
digitalWrite(PIN_LED2, LOW);
|
||||||
|
pinMode(PIN_LED2, OUTPUT);
|
||||||
|
}
|
184
variants/seeed_wio_tracker_L1/variant.h
Normal file
184
variants/seeed_wio_tracker_L1/variant.h
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
#ifndef _SEEED_TRACKER_L1_H_
|
||||||
|
#define _SEEED_TRACKER_L1_H_
|
||||||
|
#include "WVariant.h"
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Clock Configuration
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define VARIANT_MCK (64000000ul) // Master clock frequency
|
||||||
|
#define USE_LFXO // 32.768kHz crystal for LFCLK
|
||||||
|
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Pin Capacity Definitions
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define PINS_COUNT (33u) // Total GPIO pins
|
||||||
|
#define NUM_DIGITAL_PINS (33u) // Digital I/O pins
|
||||||
|
#define NUM_ANALOG_INPUTS (8u) // Analog inputs (A0-A5 + VBAT + AREF)
|
||||||
|
#define NUM_ANALOG_OUTPUTS (0u)
|
||||||
|
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// LED Configuration
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// LEDs
|
||||||
|
// LEDs
|
||||||
|
#define PIN_LED1 (11) // LED P1.15
|
||||||
|
#define PIN_LED2 (12) //
|
||||||
|
|
||||||
|
#define LED_BUILTIN PIN_LED1
|
||||||
|
#define LED_CONN PIN_LED2
|
||||||
|
|
||||||
|
#define LED_GREEN PIN_LED1
|
||||||
|
#define LED_BLUE PIN_LED2
|
||||||
|
// #define LED_PIN PIN_LED2
|
||||||
|
#define LED_STATE_ON 1 // State when LED is litted
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Button Configuration
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define BUTTON_PIN D13 // This is the Program Button
|
||||||
|
// #define BUTTON_NEED_PULLUP 1
|
||||||
|
#define BUTTON_ACTIVE_LOW true
|
||||||
|
#define BUTTON_ACTIVE_PULLUP false
|
||||||
|
|
||||||
|
#define BUTTON_PIN_TOUCH 13 // Touch button
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Digital Pin Mapping (D0-D10)
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define D0 0 // P1.06 GNSS_WAKEUP/IO0
|
||||||
|
#define D1 1 // P0.07 LORA_DIO1
|
||||||
|
#define D2 2 // P1.07 LORA_RESET
|
||||||
|
#define D3 3 // P1.10 LORA_BUSY
|
||||||
|
#define D4 4 // P1.14 LORA_CS
|
||||||
|
#define D5 5 // P1.08 LORA_SW
|
||||||
|
#define D6 6 // P0.27 GNSS_TX
|
||||||
|
#define D7 7 // P0.26 GNSS_RX
|
||||||
|
#define D8 8 // P0.30 SPI_SCK
|
||||||
|
#define D9 9 // P0.03 SPI_MISO
|
||||||
|
#define D10 10 // P0.28 SPI_MOSI
|
||||||
|
#define D12 12 // P1.00 Buzzer
|
||||||
|
#define D13 13 // P0.08 User Button
|
||||||
|
#define D14 14 // P0.05 OLED SCL
|
||||||
|
#define D15 15 // P0.06 OLED SDA
|
||||||
|
#define D16 16 // P0.31 VBAT_ADC
|
||||||
|
#define D17 17 // P0.00 GROVE SDA
|
||||||
|
#define D18 18 // P0.01 GROVE_SCL
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Analog Pin Definitions
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define PIN_A0 0 // P0.02 Analog Input 0
|
||||||
|
#define PIN_A1 1 // P0.03 Analog Input 1
|
||||||
|
#define PIN_A2 2 // P0.28 Analog Input 2
|
||||||
|
#define PIN_A3 3 // P0.29 Analog Input 3
|
||||||
|
#define PIN_A4 4 // P0.04 Analog Input 4
|
||||||
|
#define PIN_A5 5 // P0.05 Analog Input 5
|
||||||
|
#define PIN_VBAT D16 // P0.31 Battery voltage sense
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Communication Interfaces
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// I2C Configuration
|
||||||
|
#define HAS_WIRE 1
|
||||||
|
#define PIN_WIRE_SDA D14 // P0.09
|
||||||
|
#define PIN_WIRE_SCL D15 // P0.10
|
||||||
|
#define WIRE_INTERFACES_COUNT 1
|
||||||
|
#define I2C_NO_RESCAN
|
||||||
|
|
||||||
|
static const uint8_t SDA = PIN_WIRE_SDA;
|
||||||
|
static const uint8_t SCL = PIN_WIRE_SCL;
|
||||||
|
|
||||||
|
#define HAS_SCREEN 1
|
||||||
|
#define USE_SSD1306 1
|
||||||
|
|
||||||
|
// SPI Configuration (SX1262)
|
||||||
|
|
||||||
|
#define SPI_INTERFACES_COUNT 1
|
||||||
|
#define PIN_SPI_MISO 9 // P0.03 (D9)
|
||||||
|
#define PIN_SPI_MOSI 10 // P0.28 (D10)
|
||||||
|
#define PIN_SPI_SCK 8 // P0.30 (D8)
|
||||||
|
|
||||||
|
// SX1262 LoRa Module Pins
|
||||||
|
#define USE_SX1262
|
||||||
|
#define SX126X_CS D4 // Chip select
|
||||||
|
#define SX126X_DIO1 D1 // Digital IO 1 (Interrupt)
|
||||||
|
#define SX126X_BUSY D3 // Busy status
|
||||||
|
#define SX126X_RESET D2 // Reset control
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // TCXO supply voltage
|
||||||
|
#define SX126X_RXEN D5 // RX enable control
|
||||||
|
#define SX126X_TXEN RADIOLIB_NC
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH // This Line is really necessary for SX1262 to work with RF switch or will loss TX power
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Power Management
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
#define BAT_READ 30 // D30 = P0.04 Reads battery voltage from divider on signal board.
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||||
|
#define ADC_MULTIPLIER 2.0
|
||||||
|
#define BATTERY_PIN PIN_VBAT // PIN_A7
|
||||||
|
#define AREF_VOLTAGE 3.6
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// GPS L76KB
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#define GPS_L76K
|
||||||
|
#ifdef GPS_L76K
|
||||||
|
#define PIN_GPS_RX D6 // P0.26
|
||||||
|
#define PIN_GPS_TX D7
|
||||||
|
#define HAS_GPS 1
|
||||||
|
#define GPS_BAUDRATE 9600
|
||||||
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
#define PIN_SERIAL1_RX PIN_GPS_TX
|
||||||
|
#define PIN_SERIAL1_TX PIN_GPS_RX
|
||||||
|
|
||||||
|
#define GPS_RX_PIN PIN_GPS_TX
|
||||||
|
#define GPS_TX_PIN PIN_GPS_RX
|
||||||
|
#define PIN_GPS_STANDBY D0
|
||||||
|
|
||||||
|
// #define GPS_DEBUG
|
||||||
|
// #define GPS_EN D18 // P1.05
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// On-board QSPI Flash
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// On-board QSPI Flash
|
||||||
|
#define PIN_QSPI_SCK (21)
|
||||||
|
#define PIN_QSPI_CS (22)
|
||||||
|
#define PIN_QSPI_IO0 (23)
|
||||||
|
#define PIN_QSPI_IO1 (24)
|
||||||
|
#define PIN_QSPI_IO2 (25)
|
||||||
|
#define PIN_QSPI_IO3 (26)
|
||||||
|
|
||||||
|
#define EXTERNAL_FLASH_DEVICES P25Q16H
|
||||||
|
#define EXTERNAL_FLASH_USE_QSPI
|
||||||
|
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Buzzer
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Buzzer
|
||||||
|
|
||||||
|
#define PIN_BUZZER D12 // P1.00, pwm output
|
||||||
|
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// joystick
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
#define CANNED_MESSAGE_MODULE_ENABLE 1
|
||||||
|
|
||||||
|
// trackball
|
||||||
|
#define HAS_TRACKBALL 1
|
||||||
|
#define TB_UP 25
|
||||||
|
#define TB_DOWN 26
|
||||||
|
#define TB_LEFT 27
|
||||||
|
#define TB_RIGHT 28
|
||||||
|
#define TB_PRESS 29
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
// Compatibility Definitions
|
||||||
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
// Serial port placeholders
|
||||||
|
|
||||||
|
#define PIN_SERIAL2_RX (-1)
|
||||||
|
#define PIN_SERIAL2_TX (-1)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _SEEED_SOLAR_NODE_H_
|
Loading…
Reference in New Issue
Block a user