rgb led support for unPhone

This commit is contained in:
Gareth Coleman
2024-04-16 21:28:12 +01:00
parent 385d7296fe
commit 8a3322fbcb
4 changed files with 86 additions and 7 deletions

View File

@@ -494,11 +494,15 @@ void setup()
* "found".
*/
// Only one supported RGB LED currently
// Only one supported I2C RGB LED currently (plus common anode RGB LED used by the unPhone)
#ifdef HAS_NCP5623
rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
#endif
#ifdef UNPHONE
rgb_found.type = ScanI2C::DeviceType::RGBLED_CA;
#endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
auto acc_info = i2cScanner->firstAccelerometer();
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
@@ -590,6 +594,20 @@ void setup()
if (config.display.oled != meshtastic_Config_DisplayConfig_OledType_OLED_AUTO)
screen_model = config.display.oled;
#ifdef UNPHONE
// initialise IO expander with pinmodes
Wire.beginTransmission(0x26);
Wire.write(0x06);
Wire.write(0x7A);
Wire.write(0xDD);
Wire.endTransmission();
Wire.beginTransmission(0x26);
Wire.write(0x02);
Wire.write(0x04); // Backlight on
Wire.write(0x22); // G&B LEDs off
Wire.endTransmission();
#endif
#if defined(USE_SH1107)
screen_model = meshtastic_Config_DisplayConfig_OledType_OLED_SH1107; // set dimension of 128x128
display_geometry = GEOMETRY_128_128;