Merge pull request #3647 from garethhcoleman/RGBLED

Support for generic 4pin RGB LEDs (both CC and CA) and NeoPixels, also RGB LED and vibration notification support for unPhone
This commit is contained in:
Thomas Göttgens 2024-04-23 13:57:23 +02:00 committed by GitHub
commit 3302fbcc53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 223 additions and 59 deletions

View File

@ -5,6 +5,16 @@
NCP5623 rgb; NCP5623 rgb;
#endif #endif
#ifdef HAS_NEOPIXEL
#include <graphics/NeoPixel.h>
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE);
#endif
#ifdef UNPHONE
#include "unPhone.h"
extern unPhone unphone;
#endif
namespace concurrency namespace concurrency
{ {
class AmbientLightingThread : public concurrency::OSThread class AmbientLightingThread : public concurrency::OSThread
@ -27,15 +37,31 @@ class AmbientLightingThread : public concurrency::OSThread
disable(); disable();
return; return;
} }
#endif
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
if (!moduleConfig.ambient_lighting.led_state) { if (!moduleConfig.ambient_lighting.led_state) {
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n"); LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
disable(); disable();
return; return;
} }
LOG_DEBUG("AmbientLightingThread initializing\n"); LOG_DEBUG("AmbientLightingThread initializing\n");
#ifdef HAS_NCP5623
if (_type == ScanI2C::NCP5623) { if (_type == ScanI2C::NCP5623) {
rgb.begin(); rgb.begin();
#endif
#ifdef RGBLED_RED
pinMode(RGBLED_RED, OUTPUT);
pinMode(RGBLED_GREEN, OUTPUT);
pinMode(RGBLED_BLUE, OUTPUT);
#endif
#ifdef HAS_NEOPIXEL
pixels.begin(); // Initialise the pixel(s)
pixels.clear(); // Set all pixel colors to 'off'
pixels.setBrightness(moduleConfig.ambient_lighting.current);
#endif
setLighting(); setLighting();
#endif
#ifdef HAS_NCP5623
} }
#endif #endif
} }
@ -43,16 +69,17 @@ class AmbientLightingThread : public concurrency::OSThread
protected: protected:
int32_t runOnce() override int32_t runOnce() override
{ {
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) { if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
#endif
setLighting(); setLighting();
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
} else { #ifdef HAS_NCP5623
return disable();
} }
#else
return disable();
#endif #endif
#endif
return disable();
} }
private: private:
@ -65,9 +92,36 @@ class AmbientLightingThread : public concurrency::OSThread
rgb.setRed(moduleConfig.ambient_lighting.red); rgb.setRed(moduleConfig.ambient_lighting.red);
rgb.setGreen(moduleConfig.ambient_lighting.green); rgb.setGreen(moduleConfig.ambient_lighting.green);
rgb.setBlue(moduleConfig.ambient_lighting.blue); rgb.setBlue(moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n", LOG_DEBUG("Initializing NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue); moduleConfig.ambient_lighting.blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue),
0, NEOPIXEL_COUNT);
pixels.show();
LOG_DEBUG("Initializing NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
moduleConfig.ambient_lighting.blue);
#endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d\n",
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif
#ifdef UNPHONE
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d\n", moduleConfig.ambient_lighting.red,
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
#endif #endif
} }
}; };

View File

@ -41,9 +41,7 @@ class ScanI2C
BQ24295, BQ24295,
LSM6DS3, LSM6DS3,
TCA9555, TCA9555,
#ifdef HAS_NCP5623
NCP5623, NCP5623,
#endif
} DeviceType; } DeviceType;
// typedef uint8_t DeviceAddress; // typedef uint8_t DeviceAddress;

4
src/graphics/NeoPixel.h Normal file
View File

@ -0,0 +1,4 @@
#ifdef HAS_NEOPIXEL
#include <Adafruit_NeoPixel.h>
extern Adafruit_NeoPixel pixels;
#endif

View File

@ -612,7 +612,9 @@ void setup()
} }
#endif #endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) #if defined(HAS_NEOPIXEL) || defined(UNPHONE) || defined(RGBLED_RED)
ambientLightingThread = new AmbientLightingThread(ScanI2C::DeviceType::NONE);
#elif !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
if (rgb_found.type != ScanI2C::DeviceType::NONE) { if (rgb_found.type != ScanI2C::DeviceType::NONE) {
ambientLightingThread = new AmbientLightingThread(rgb_found.type); ambientLightingThread = new AmbientLightingThread(rgb_found.type);
} }

View File

@ -26,7 +26,18 @@
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
#include <graphics/RAKled.h> #include <graphics/RAKled.h>
#endif
#ifdef HAS_NEOPIXEL
#include <graphics/NeoPixel.h>
#endif
#ifdef UNPHONE
#include "unPhone.h"
extern unPhone unphone;
#endif
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
uint8_t red = 0; uint8_t red = 0;
uint8_t green = 0; uint8_t green = 0;
uint8_t blue = 0; uint8_t blue = 0;
@ -108,27 +119,44 @@ int32_t ExternalNotificationModule::runOnce()
millis()) { millis()) {
getExternal(2) ? setExternalOff(2) : setExternalOn(2); getExternal(2) ? setExternalOff(2) : setExternalOn(2);
} }
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7
green = (colorState & 2) ? brightnessValues[brightnessIndex] : 0; // Green enabled on colorState = 2,3,6,7
blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) { if (rgb_found.type == ScanI2C::NCP5623) {
red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7
green = (colorState & 2) ? brightnessValues[brightnessIndex] : 0; // Green enabled on colorState = 2,3,6,7
blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
}
if (ascending) { // fade in #endif
brightnessIndex++; #ifdef RGBLED_CA
if (brightnessIndex == (sizeof(brightnessValues) - 1)) { analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
ascending = false; analogWrite(RGBLED_GREEN, 255 - green);
} analogWrite(RGBLED_BLUE, 255 - blue);
} else { #elif defined(RGBLED_RED)
brightnessIndex--; // fade out analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
if (ascending) { // fade in
brightnessIndex++;
if (brightnessIndex == (sizeof(brightnessValues) - 1)) {
ascending = false;
} }
if (brightnessIndex == 0) { } else {
ascending = true; brightnessIndex--; // fade out
colorState++; // next color }
if (colorState > 7) { if (brightnessIndex == 0) {
colorState = 1; ascending = true;
} colorState++; // next color
if (colorState > 7) {
colorState = 1;
} }
} }
#endif #endif
@ -179,6 +207,9 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
switch (index) { switch (index) {
case 1: case 1:
#ifdef UNPHONE
unphone.vibe(true); // the unPhone's vibration motor is on a i2c GPIO expander
#endif
if (moduleConfig.external_notification.output_vibra) if (moduleConfig.external_notification.output_vibra)
digitalWrite(moduleConfig.external_notification.output_vibra, true); digitalWrite(moduleConfig.external_notification.output_vibra, true);
break; break;
@ -197,6 +228,22 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
} }
#endif #endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
analogWrite(RGBLED_GREEN, 255 - green);
analogWrite(RGBLED_BLUE, 255 - blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
drv.go(); drv.go();
#endif #endif
@ -209,6 +256,9 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
switch (index) { switch (index) {
case 1: case 1:
#ifdef UNPHONE
unphone.vibe(false); // the unPhone's vibration motor is on a i2c GPIO expander
#endif
if (moduleConfig.external_notification.output_vibra) if (moduleConfig.external_notification.output_vibra)
digitalWrite(moduleConfig.external_notification.output_vibra, false); digitalWrite(moduleConfig.external_notification.output_vibra, false);
break; break;
@ -222,14 +272,33 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
break; break;
} }
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
red = 0;
green = 0;
blue = 0;
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
if (rgb_found.type == ScanI2C::NCP5623) { if (rgb_found.type == ScanI2C::NCP5623) {
red = 0;
green = 0;
blue = 0;
rgb.setColor(red, green, blue); rgb.setColor(red, green, blue);
} }
#endif #endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
analogWrite(RGBLED_GREEN, 255 - green);
analogWrite(RGBLED_BLUE, 255 - blue);
#elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, red);
analogWrite(RGBLED_GREEN, green);
analogWrite(RGBLED_BLUE, blue);
#endif
#ifdef HAS_NEOPIXEL
pixels.fill(pixels.Color(red, green, blue), 0, NEOPIXEL_COUNT);
pixels.show();
#endif
#ifdef UNPHONE
unphone.rgb(red, green, blue);
#endif
#endif
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
drv.stop(); drv.stop();
#endif #endif
@ -328,6 +397,21 @@ ExternalNotificationModule::ExternalNotificationModule()
rgb.begin(); rgb.begin();
rgb.setCurrent(10); rgb.setCurrent(10);
} }
#endif
#ifdef RGBLED_RED
pinMode(RGBLED_RED, OUTPUT); // set up the RGB led pins
pinMode(RGBLED_GREEN, OUTPUT);
pinMode(RGBLED_BLUE, OUTPUT);
#endif
#ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255); // with a common anode type, logic is reversed
analogWrite(RGBLED_GREEN, 255); // so we want to initialise with lights off
analogWrite(RGBLED_BLUE, 255);
#endif
#ifdef HAS_NEOPIXEL
pixels.begin(); // Initialise the pixel(s)
pixels.clear(); // Set all pixel colors to 'off'
pixels.setBrightness(moduleConfig.ambient_lighting.current);
#endif #endif
} else { } else {
LOG_INFO("External Notification Module Disabled\n"); LOG_INFO("External Notification Module Disabled\n");
@ -509,4 +593,4 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
if (changed) { if (changed) {
nodeDB->saveProto(rtttlConfigFile, meshtastic_RTTTLConfig_size, &meshtastic_RTTTLConfig_msg, &rtttlConfig); nodeDB->saveProto(rtttlConfigFile, meshtastic_RTTTLConfig_size, &meshtastic_RTTTLConfig_msg, &rtttlConfig);
} }
} }

View File

@ -29,10 +29,7 @@ const uint32_t g_ADigitalPinMap[] = {
void initVariant() void initVariant()
{ {
// LED1 & LED2 // LED1
pinMode(PIN_LED1, OUTPUT); pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1); ledOff(PIN_LED1);
}
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
}

View File

@ -43,16 +43,12 @@ extern "C" {
#define NUM_ANALOG_OUTPUTS (0) #define NUM_ANALOG_OUTPUTS (0)
// LEDs // LEDs
#define PIN_LED1 (0 + 12) // Blue LED P1.12 #define PIN_LED1 (0 + 6) // Built in Green P0.06
#define PIN_LED2 (0 + 6) // Built in Green P0.06 #define PIN_LED2 (0 + 6) // Just here for completeness
#define RGBLED_RED (0 + 8) // Red of RGB P0.08
// Green Built in LED1 #define RGBLED_GREEN (32 + 9) // Green of RGB P1.09
// #define PIN_LED1 (0 + 6) // LED1 P1.15 #define RGBLED_BLUE (0 + 12) // Blue of RGB P0.12
#define RGBLED_CA // comment out this line if you have a common cathode type, as defined use common anode logic
// RGB NeoPixel LED2
// #define PIN_LED1 (0 + 8) Red
// #define PIN_LED1 (32 + 9) Green
// #define PIN_LED1 (0 + 12) Blue
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2 #define LED_CONN PIN_LED2
@ -168,4 +164,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
* Arduino objects - C++ only * Arduino objects - C++ only
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
#endif #endif

View File

@ -15,4 +15,4 @@ upload_protocol = esptool
upload_speed = 460800 upload_speed = 460800
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
makuna/NeoPixelBus@^2.7.1 adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -1,5 +1,4 @@
// https://betafpv.com/products/elrs-micro-tx-module // https://betafpv.com/products/elrs-micro-tx-module
#include <NeoPixelBus.h>
// 0.96" OLED // 0.96" OLED
#define I2C_SDA 22 #define I2C_SDA 22
@ -15,7 +14,11 @@
#define LORA_CS 5 #define LORA_CS 5
#define RF95_FAN_EN 17 #define RF95_FAN_EN 17
#define LED_PIN 16 // This is a LED_WS2812 not a standard LED // #define LED_PIN 16 // This is a LED_WS2812 not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 16 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 25 #define BUTTON_PIN 25
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP
@ -31,4 +34,4 @@
#define SX128X_TXEN 26 #define SX128X_TXEN 26
#define SX128X_RXEN 27 #define SX128X_RXEN 27
#define SX128X_RESET LORA_RESET #define SX128X_RESET LORA_RESET
#define SX128X_MAX_POWER 13 #define SX128X_MAX_POWER 13

View File

@ -22,4 +22,4 @@ build_flags = ${esp32_base.build_flags}
lib_deps = ${esp32s3_base.lib_deps} lib_deps = ${esp32s3_base.lib_deps}
zinggjm/GxEPD2@^1.5.3 zinggjm/GxEPD2@^1.5.3
;adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -10,6 +10,10 @@
// #define LED_PIN PIN_LED // #define LED_PIN PIN_LED
// Board has RGB LED 21 // Board has RGB LED 21
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 21 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
// The usbPower state is revered ? // The usbPower state is revered ?
// DEBUG | ??:??:?? 365 [Power] Battery: usbPower=0, isCharging=0, batMv=4116, batPct=90 // DEBUG | ??:??:?? 365 [Power] Battery: usbPower=0, isCharging=0, batMv=4116, batPct=90

View File

@ -20,4 +20,5 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/lora_relay_v1>
lib_deps = lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0 sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
bodmer/TFT_eSPI@^2.4.76 bodmer/TFT_eSPI@^2.4.76
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -44,7 +44,11 @@ extern "C" {
// LEDs // LEDs
#define PIN_LED1 (3) #define PIN_LED1 (3)
#define PIN_LED2 (4) #define PIN_LED2 (4)
#define PIN_NEOPIXEL (8) // #define PIN_NEOPIXEL (8)
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 8 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2 #define LED_CONN PIN_LED2

View File

@ -23,3 +23,4 @@ lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0 sparkfun/SparkFun BQ27441 LiPo Fuel Gauge Arduino Library@^1.1.0
bodmer/TFT_eSPI@^2.4.76 bodmer/TFT_eSPI@^2.4.76
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -61,7 +61,12 @@ extern "C" {
// LEDs // LEDs
#define PIN_LED1 (3) #define PIN_LED1 (3)
#define PIN_LED2 (4) #define PIN_LED2 (4)
#define PIN_NEOPIXEL (8) // #define PIN_NEOPIXEL (8)
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 8 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define PIN_BUZZER (40) #define PIN_BUZZER (40)
#define LED_BUILTIN PIN_LED1 #define LED_BUILTIN PIN_LED1

View File

@ -13,7 +13,7 @@ platform_packages =
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
zinggjm/GxEPD2@^1.5.1 zinggjm/GxEPD2@^1.5.1
adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0
build_unflags = -DARDUINO_USB_MODE=1 build_unflags = -DARDUINO_USB_MODE=1
build_flags = build_flags =
;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink
@ -24,4 +24,4 @@ build_flags =
-DEINK_HEIGHT=128 -DEINK_HEIGHT=128
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-issue
-DARDUINO_USB_MODE=0 -DARDUINO_USB_MODE=0

View File

@ -12,6 +12,10 @@
#define I2C_SCL 17 // 2 #define I2C_SCL 17 // 2
// #define LED_PIN 38 // This is a RGB LED not a standard LED // #define LED_PIN 38 // This is a RGB LED not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 38 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_PIN 0 // This is the BOOT button
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP

View File

@ -12,11 +12,11 @@ platform_packages =
tool-esptoolpy@^1.40500.0 tool-esptoolpy@^1.40500.0
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
adafruit/Adafruit NeoPixel@^1.10.7 adafruit/Adafruit NeoPixel @ ^1.12.0
build_unflags = -DARDUINO_USB_MODE=1 build_unflags = -DARDUINO_USB_MODE=1
build_flags = build_flags =
;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_oled ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_oled
${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_oled ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_oled
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-issue
-DARDUINO_USB_MODE=0 -DARDUINO_USB_MODE=0

View File

@ -12,6 +12,10 @@
#define I2C_SCL 17 // 2 #define I2C_SCL 17 // 2
// #define LED_PIN 38 // This is a RGB LED not a standard LED // #define LED_PIN 38 // This is a RGB LED not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 38 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 0 // This is the BOOT button #define BUTTON_PIN 0 // This is the BOOT button
#define BUTTON_NEED_PULLUP #define BUTTON_NEED_PULLUP
@ -53,4 +57,4 @@
// #define PIN_EINK_DC 1 // #define PIN_EINK_DC 1
// #define PIN_EINK_RES (-1) // #define PIN_EINK_RES (-1)
// #define PIN_EINK_SCLK 5 // #define PIN_EINK_SCLK 5
// #define PIN_EINK_MOSI 6 // #define PIN_EINK_MOSI 6

View File

@ -13,6 +13,7 @@ build_unflags =
-D ARDUINO_USB_MODE -D ARDUINO_USB_MODE
build_flags = ${esp32_base.build_flags} build_flags = ${esp32_base.build_flags}
;-D BOARD_HAS_PSRAM // what's up with this - doesn't seem to be recognised at boot
-D UNPHONE -D UNPHONE
-I variants/unphone -I variants/unphone
-D ARDUINO_USB_MODE=0 -D ARDUINO_USB_MODE=0
@ -27,4 +28,5 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone>
lib_deps = ${esp32s3_base.lib_deps} lib_deps = ${esp32s3_base.lib_deps}
lovyan03/LovyanGFX @ ^1.1.8 lovyan03/LovyanGFX @ ^1.1.8
https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic @ ^9.0.0
adafruit/Adafruit NeoPixel @ ^1.12.0

View File

@ -10,6 +10,7 @@ void initVariant()
unphone.printWakeupReason(); // what woke us up? (stored, not printed :|) unphone.printWakeupReason(); // what woke us up? (stored, not printed :|)
unphone.checkPowerSwitch(); // if power switch is off, shutdown unphone.checkPowerSwitch(); // if power switch is off, shutdown
unphone.backlight(false); // setup backlight and make sure its off unphone.backlight(false); // setup backlight and make sure its off
unphone.expanderPower(true); // enable power to expander / hat / sheild
for (int i = 0; i < 3; i++) { // buzz a bit for (int i = 0; i < 3; i++) { // buzz a bit
unphone.vibe(true); unphone.vibe(true);