mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-25 11:17:25 +00:00
Merge branch 'meshtastic:master' into StandaloneAddons
This commit is contained in:
@@ -22,10 +22,6 @@
|
||||
#include "graphics/niche/Drivers/EInk/GDEY0154D67.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
@@ -33,14 +29,13 @@ void setupNicheGraphics()
|
||||
// SPI
|
||||
// -----------------------------
|
||||
|
||||
// For NRF52 platforms, SPI pins are defined in variant.h, not passed to begin()
|
||||
// For NRF52 platforms, SPI pins are defined in variant.h
|
||||
SPI1.begin();
|
||||
|
||||
// Driver
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::GDEY0154D67; // Todo: confirm display model
|
||||
Drivers::EInk *driver = new Drivers::GDEY0154D67;
|
||||
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
// InkHUD
|
||||
@@ -48,7 +43,7 @@ void setupNicheGraphics()
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
@@ -57,33 +52,27 @@ void setupNicheGraphics()
|
||||
// Currently set to the values given by Elecrow for EInkDynamicDisplay.
|
||||
inkhud->setDisplayResilience(10, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side
|
||||
inkhud->persistence->settings.rotation = 0; // To be confirmed?
|
||||
inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery
|
||||
|
||||
// Setup backlight
|
||||
// Note: button mapping for this configured further down
|
||||
// Setup backlight controller
|
||||
// Note: button is attached further down
|
||||
Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance();
|
||||
backlight->setPin(PIN_EINK_EN);
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
|
||||
|
||||
// Start running InkHUD
|
||||
@@ -94,25 +83,25 @@ void setupNicheGraphics()
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||
|
||||
// As labeled on Elecrow diagram: https://www.elecrow.com/download/product/CIL12901M/ThinkNode-M1_User_Manual.pdf
|
||||
constexpr uint8_t PAGE_TURN_BUTTON = 0;
|
||||
constexpr uint8_t FUNCTION_BUTTON = 1;
|
||||
// Elecrow diagram: https://www.elecrow.com/download/product/CIL12901M/ThinkNode-M1_User_Manual.pdf
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(PAGE_TURN_BUTTON, PIN_BUTTON2);
|
||||
buttons->setTiming(PAGE_TURN_BUTTON, 50, 500); // Todo: confirm 50ms is adequate debounce
|
||||
buttons->setHandlerShortPress(PAGE_TURN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(PAGE_TURN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
// #0: Main User Button
|
||||
// Labeled "Page Turn Button" by manual
|
||||
buttons->setWiring(0, PIN_BUTTON2);
|
||||
buttons->setTiming(0, 50, 500); // Todo: confirm 50ms is adequate debounce
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// Setup the aux button
|
||||
// Initial testing only: mapped to the backlight
|
||||
// #1: Aux Button
|
||||
// Labeled "Function Button" by manual
|
||||
// Todo: additional features
|
||||
buttons->setWiring(FUNCTION_BUTTON, PIN_BUTTON1);
|
||||
buttons->setTiming(FUNCTION_BUTTON, 50, 500); // 500ms before latch
|
||||
buttons->setHandlerDown(FUNCTION_BUTTON, [backlight]() { backlight->peek(); });
|
||||
buttons->setHandlerLongPress(FUNCTION_BUTTON, [backlight]() { backlight->latch(); });
|
||||
buttons->setHandlerShortPress(FUNCTION_BUTTON, [backlight]() { backlight->off(); });
|
||||
buttons->setWiring(1, PIN_BUTTON1);
|
||||
buttons->setTiming(1, 50, 500); // 500ms before latch
|
||||
buttons->setHandlerDown(1, [backlight]() { backlight->peek(); });
|
||||
buttons->setHandlerLongPress(1, [backlight]() { backlight->latch(); });
|
||||
buttons->setHandlerShortPress(1, [backlight]() { backlight->off(); });
|
||||
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,54 +16,42 @@
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/EInk/LCMEN2R13ECC1.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
|
||||
// SPI
|
||||
// -----------------------------
|
||||
SPIClass *spi1 = &SPI1;
|
||||
spi1->begin();
|
||||
// Display is connected to SPI1
|
||||
|
||||
// For NRF52 platforms, SPI pins are defined in variant.h
|
||||
SPI1.begin();
|
||||
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
// Use E-Ink driver
|
||||
|
||||
Drivers::EInk *driver = new Drivers::LCMEN2R13ECC1;
|
||||
driver->begin(spi1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
// InkHUD
|
||||
// ----------------------------
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(10, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
@@ -72,15 +60,14 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = true;
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -89,18 +76,13 @@ void setupNicheGraphics()
|
||||
// --------------------------
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||
constexpr uint8_t MAIN_BUTTON = 0;
|
||||
// constexpr uint8_t AUX_BUTTON = 1;
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
// #0: Main User Button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// Setup the aux button
|
||||
// Bonus feature of VME213
|
||||
// buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY);
|
||||
// buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::InkHUD::getInstance()->nextTile(); });
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,18 +16,11 @@
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
@@ -42,7 +35,6 @@ void setupNicheGraphics()
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::LCMEN213EFC1;
|
||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
@@ -51,21 +43,16 @@ void setupNicheGraphics()
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(10, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
@@ -74,15 +61,14 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -91,18 +77,17 @@ void setupNicheGraphics()
|
||||
// --------------------------
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||
constexpr uint8_t MAIN_BUTTON = 0;
|
||||
constexpr uint8_t AUX_BUTTON = 1;
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
// #0: Main User Button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// Setup the aux button
|
||||
// Bonus feature of VME213
|
||||
buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY);
|
||||
buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::InkHUD::getInstance()->nextTile(); });
|
||||
// #1: Aux Button
|
||||
buttons->setWiring(1, BUTTON_PIN_SECONDARY);
|
||||
buttons->setHandlerShortPress(1, [inkhud]() { inkhud->nextTile(); });
|
||||
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,11 @@ Different NicheGraphics UIs and different hardware variants will each have their
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/EInk/DEPG0290BNS800.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
@@ -55,7 +48,6 @@ void setupNicheGraphics()
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::DEPG0290BNS800;
|
||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY);
|
||||
|
||||
@@ -64,21 +56,16 @@ void setupNicheGraphics()
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(7, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
@@ -87,22 +74,14 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead
|
||||
|
||||
// Pick applets
|
||||
|
||||
// Order of applets determines priority of "auto-show" feature.
|
||||
// Optional arguments for default state:
|
||||
// - is activated?
|
||||
// - is autoshown?
|
||||
// - is foreground on a specific tile (index)?
|
||||
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -112,16 +91,16 @@ void setupNicheGraphics()
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // A shared NicheGraphics component
|
||||
|
||||
// Setup the main user button (0)
|
||||
// #0: Main User Button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(0, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// Setup the aux button (1)
|
||||
// Bonus feature of VME290
|
||||
// #1: Aux Button
|
||||
buttons->setWiring(1, BUTTON_PIN_SECONDARY);
|
||||
buttons->setHandlerShortPress(1, []() { InkHUD::InkHUD::getInstance()->nextTile(); });
|
||||
buttons->setHandlerShortPress(1, [inkhud]() { inkhud->nextTile(); });
|
||||
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,18 +16,11 @@
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
@@ -42,7 +35,6 @@ void setupNicheGraphics()
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::LCMEN213EFC1;
|
||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
@@ -51,21 +43,16 @@ void setupNicheGraphics()
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(10, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
@@ -73,15 +60,14 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -90,15 +76,15 @@ void setupNicheGraphics()
|
||||
// --------------------------
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||
constexpr uint8_t MAIN_BUTTON = 0;
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
// #0: Main User Button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// No aux button on this board
|
||||
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
|
||||
19
variants/link32_s3_v1/pins_arduino.h
Normal file
19
variants/link32_s3_v1/pins_arduino.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define USB_VID 0x303a
|
||||
#define USB_PID 0x1001
|
||||
|
||||
// The default Wire will be mapped to PMU and RTC
|
||||
static const uint8_t SDA = 47;
|
||||
static const uint8_t SCL = 48;
|
||||
|
||||
// Default SPI will be mapped to Radio
|
||||
static const uint8_t SS = 21;
|
||||
static const uint8_t MOSI = 34;
|
||||
static const uint8_t MISO = 33;
|
||||
static const uint8_t SCK = 16;
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
11
variants/link32_s3_v1/platformio.ini
Normal file
11
variants/link32_s3_v1/platformio.ini
Normal file
@@ -0,0 +1,11 @@
|
||||
[env:link32-s3-v1]
|
||||
extends = esp32s3_base
|
||||
board = esp32-s3-devkitc-1
|
||||
build_flags =
|
||||
${esp32_base.build_flags} -D LINK_32 -I variants/link32_s3_v1
|
||||
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
|
||||
-DARDUINO_USB_CDC_ON_BOOT
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DRADIOLIB_EXCLUDE_SX128X=1
|
||||
-DRADIOLIB_EXCLUDE_SX127X=1
|
||||
-DRADIOLIB_EXCLUDE_LR11X0=1
|
||||
42
variants/link32_s3_v1/variant.h
Normal file
42
variants/link32_s3_v1/variant.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#define BATTERY_PIN 15
|
||||
#define ADC_CHANNEL ADC2_GPIO15_CHANNEL // ADC channel for battery voltage measurement
|
||||
#define BATTERY_SENSE_SAMPLES 30
|
||||
#define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 for battery measurement
|
||||
|
||||
#define USE_SSD1306
|
||||
|
||||
#define BUTTON_PIN 0 // Button pin for this board
|
||||
#define BUTTON_PIN_ALT 36
|
||||
|
||||
#define HAS_NEOPIXEL // If defined, we will use the neopixel library
|
||||
#define NEOPIXEL_DATA 35 // Neopixel pin for this board
|
||||
#define NEOPIXEL_COUNT 1 // Number of neopixels on this board
|
||||
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
|
||||
|
||||
#define ADC_MULTIPLIER 2
|
||||
|
||||
#define I2C_SDA 47 // I2C pins for this board
|
||||
#define I2C_SCL 48
|
||||
|
||||
#define USE_SX1262
|
||||
|
||||
#define LORA_SCK 16
|
||||
#define LORA_MISO 33
|
||||
#define LORA_MOSI 34
|
||||
#define LORA_CS 21
|
||||
#define LORA_RESET 18
|
||||
|
||||
#define LORA_DIO0 12 // a No connect on the SX1262 module
|
||||
#define LORA_DIO1 13
|
||||
#define LORA_DIO2 14 // Not really used
|
||||
|
||||
#define LORA_TCXO_GPIO 17
|
||||
|
||||
#define TCXO_OPTIONAL
|
||||
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY LORA_DIO2
|
||||
#define SX126X_RESET LORA_RESET
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
@@ -20,8 +20,8 @@
|
||||
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
// LEDs
|
||||
// LEDs
|
||||
#define PIN_LED1 (11) // LED P1.15
|
||||
#define PIN_LED2 (12) //
|
||||
#define PIN_LED1 (12) // LED P1.15
|
||||
#define PIN_LED2 (11) //
|
||||
|
||||
#define LED_BUILTIN PIN_LED1
|
||||
#define LED_CONN PIN_LED2
|
||||
@@ -154,4 +154,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _SEEED_SOLAR_NODE_H_
|
||||
#endif // _SEEED_SOLAR_NODE_H_
|
||||
|
||||
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_
|
||||
@@ -16,19 +16,12 @@
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h"
|
||||
#include "graphics/niche/Drivers/EInk/GDEY0154D67.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
// Special case - fix T-Echo's touch button
|
||||
// ----------------------------------------
|
||||
// On a handful of T-Echos, LoRa TX triggers the capacitive touch
|
||||
@@ -42,37 +35,30 @@ void setupNicheGraphics()
|
||||
// SPI
|
||||
// -----------------------------
|
||||
|
||||
// For NRF52 platforms, SPI pins are defined in variant.h, not passed to begin()
|
||||
SPIClass *inkSPI = &SPI1;
|
||||
inkSPI->begin();
|
||||
// For NRF52 platforms, SPI pins are defined in variant.h
|
||||
SPI1.begin();
|
||||
|
||||
// Driver
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::GDEY0154D67;
|
||||
driver->begin(inkSPI, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
// InkHUD
|
||||
// ----------------------------
|
||||
|
||||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||
|
||||
// Set the driver
|
||||
// Set the E-Ink driver
|
||||
inkhud->setDriver(driver);
|
||||
|
||||
// Set how many FAST updates per FULL update
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(20, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side
|
||||
@@ -80,22 +66,20 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery
|
||||
inkhud->persistence->settings.optionalMenuItems.backlight = true; // Until proves capacitive button works by touching it
|
||||
|
||||
// Setup backlight
|
||||
// Note: AUX button behavior configured further down
|
||||
// Setup backlight controller
|
||||
// Note: AUX button attached further down
|
||||
Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance();
|
||||
backlight->setPin(PIN_EINK_EN);
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet);
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0));
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1));
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet);
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -105,22 +89,19 @@ void setupNicheGraphics()
|
||||
|
||||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||
|
||||
// (To improve code readability only)
|
||||
constexpr uint8_t MAIN_BUTTON = 0;
|
||||
constexpr uint8_t TOUCH_BUTTON = 1;
|
||||
// #0: Main User Button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setTiming(0, 75, 500);
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin());
|
||||
buttons->setTiming(MAIN_BUTTON, 75, 500);
|
||||
buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
|
||||
// Setup the capacitive touch button
|
||||
// #1: Aux Button (Capacitive Touch Button)
|
||||
// - short: momentary backlight
|
||||
// - long: latch backlight on
|
||||
buttons->setWiring(TOUCH_BUTTON, PIN_BUTTON_TOUCH);
|
||||
buttons->setTiming(TOUCH_BUTTON, 50, 5000); // 5 seconds before latch - limited by T-Echo's capacitive touch IC
|
||||
buttons->setHandlerDown(TOUCH_BUTTON, [backlight]() {
|
||||
buttons->setWiring(1, PIN_BUTTON_TOUCH);
|
||||
buttons->setTiming(1, 50, 5000); // 5 seconds before latch - limited by T-Echo's capacitive touch IC
|
||||
|
||||
buttons->setHandlerDown(1, [inkhud, backlight]() {
|
||||
// Discard the button press if radio is active
|
||||
// Rare hardware fault: LoRa activity triggers touch button
|
||||
if (!RadioLibInterface::instance || RadioLibInterface::instance->isSending())
|
||||
@@ -131,10 +112,11 @@ void setupNicheGraphics()
|
||||
|
||||
// Handler has run, which confirms touch button wasn't removed as part of DIY build.
|
||||
// No longer need the fallback backlight toggle in menu.
|
||||
InkHUD::InkHUD::getInstance()->persistence->settings.optionalMenuItems.backlight = false;
|
||||
inkhud->persistence->settings.optionalMenuItems.backlight = false;
|
||||
});
|
||||
buttons->setHandlerLongPress(TOUCH_BUTTON, [backlight]() { backlight->latch(); });
|
||||
buttons->setHandlerShortPress(TOUCH_BUTTON, [backlight]() { backlight->off(); });
|
||||
|
||||
buttons->setHandlerLongPress(1, [backlight]() { backlight->latch(); });
|
||||
buttons->setHandlerShortPress(1, [backlight]() { backlight->off(); });
|
||||
|
||||
// Begin handling button events
|
||||
buttons->start();
|
||||
|
||||
@@ -16,18 +16,11 @@
|
||||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h"
|
||||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h"
|
||||
|
||||
// Shared NicheGraphics components
|
||||
// --------------------------------
|
||||
#include "graphics/niche/Drivers/EInk/DEPG0213BNS800.h"
|
||||
#include "graphics/niche/Inputs/TwoButton.h"
|
||||
|
||||
#include "graphics/niche/Fonts/FreeSans6pt7b.h"
|
||||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h"
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
|
||||
void setupNicheGraphics()
|
||||
{
|
||||
using namespace NicheGraphics;
|
||||
@@ -42,7 +35,6 @@ void setupNicheGraphics()
|
||||
// E-Ink Driver
|
||||
// -----------------------------
|
||||
|
||||
// Use E-Ink driver
|
||||
Drivers::EInk *driver = new Drivers::DEPG0213BNS800;
|
||||
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||
|
||||
@@ -58,14 +50,9 @@ void setupNicheGraphics()
|
||||
// Set how unhealthy additional FAST updates beyond this number are
|
||||
inkhud->setDisplayResilience(15, 1.5);
|
||||
|
||||
// Prepare fonts
|
||||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b);
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b);
|
||||
/*
|
||||
// Font localization demo: Cyrillic
|
||||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic);
|
||||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251();
|
||||
*/
|
||||
// Select fonts
|
||||
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
|
||||
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||
|
||||
// Customize default settings
|
||||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||
@@ -73,15 +60,14 @@ void setupNicheGraphics()
|
||||
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
|
||||
|
||||
// Pick applets
|
||||
// Note: order of applets determines priority of "auto-show" feature
|
||||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive
|
||||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive
|
||||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0
|
||||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet);
|
||||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet);
|
||||
|
||||
// Start running InkHUD
|
||||
inkhud->begin();
|
||||
@@ -93,8 +79,8 @@ void setupNicheGraphics()
|
||||
|
||||
// Setup the main user button
|
||||
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin(), true);
|
||||
buttons->setHandlerShortPress(0, []() { InkHUD::InkHUD::getInstance()->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, []() { InkHUD::InkHUD::getInstance()->longpress(); });
|
||||
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||
|
||||
buttons->start();
|
||||
}
|
||||
|
||||
@@ -145,12 +145,12 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
||||
#ifdef EBYTE_E22_900M30S
|
||||
// 10dB PA gain and 30dB rated output; based on measurements from
|
||||
// https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt
|
||||
#define REGULATORY_GAIN_LORA 7
|
||||
#define TX_GAIN_LORA 7
|
||||
#define SX126X_MAX_POWER 22
|
||||
#endif
|
||||
#ifdef EBYTE_E22_900M33S
|
||||
// 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf
|
||||
#define REGULATORY_GAIN_LORA 25
|
||||
#define TX_GAIN_LORA 25
|
||||
#define SX126X_MAX_POWER 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user