mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 18:09:04 +00:00
Added initial support for Texas Instruments LP5562 (#6381)
Some checks are pending
CI / setup (check) (push) Waiting to run
CI / setup (esp32) (push) Waiting to run
CI / setup (esp32c3) (push) Waiting to run
CI / setup (esp32c6) (push) Waiting to run
CI / setup (esp32s3) (push) Waiting to run
CI / setup (nrf52840) (push) Waiting to run
CI / setup (rp2040) (push) Waiting to run
CI / setup (stm32) (push) Waiting to run
CI / check (push) Blocked by required conditions
CI / build-esp32 (push) Blocked by required conditions
CI / build-esp32-s3 (push) Blocked by required conditions
CI / build-esp32-c3 (push) Blocked by required conditions
CI / build-esp32-c6 (push) Blocked by required conditions
CI / build-nrf52 (push) Blocked by required conditions
CI / build-rpi2040 (push) Blocked by required conditions
CI / build-stm32 (push) Blocked by required conditions
CI / build-debian-src (push) Waiting to run
CI / package-pio-deps-native-tft (push) Waiting to run
CI / test-native (push) Waiting to run
CI / docker-debian-amd64 (push) Waiting to run
CI / docker-alpine-amd64 (push) Waiting to run
CI / docker-debian-arm64 (push) Waiting to run
CI / docker-debian-armv7 (push) Waiting to run
CI / after-checks (push) Blocked by required conditions
CI / gather-artifacts (esp32) (push) Blocked by required conditions
CI / gather-artifacts (esp32c3) (push) Blocked by required conditions
CI / gather-artifacts (esp32c6) (push) Blocked by required conditions
CI / gather-artifacts (esp32s3) (push) Blocked by required conditions
CI / gather-artifacts (nrf52840) (push) Blocked by required conditions
CI / gather-artifacts (rp2040) (push) Blocked by required conditions
CI / gather-artifacts (stm32) (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
CI / release-firmware (esp32) (push) Blocked by required conditions
CI / release-firmware (esp32c3) (push) Blocked by required conditions
CI / release-firmware (esp32c6) (push) Blocked by required conditions
CI / release-firmware (esp32s3) (push) Blocked by required conditions
CI / release-firmware (nrf52840) (push) Blocked by required conditions
CI / release-firmware (rp2040) (push) Blocked by required conditions
CI / release-firmware (stm32) (push) Blocked by required conditions
Some checks are pending
CI / setup (check) (push) Waiting to run
CI / setup (esp32) (push) Waiting to run
CI / setup (esp32c3) (push) Waiting to run
CI / setup (esp32c6) (push) Waiting to run
CI / setup (esp32s3) (push) Waiting to run
CI / setup (nrf52840) (push) Waiting to run
CI / setup (rp2040) (push) Waiting to run
CI / setup (stm32) (push) Waiting to run
CI / check (push) Blocked by required conditions
CI / build-esp32 (push) Blocked by required conditions
CI / build-esp32-s3 (push) Blocked by required conditions
CI / build-esp32-c3 (push) Blocked by required conditions
CI / build-esp32-c6 (push) Blocked by required conditions
CI / build-nrf52 (push) Blocked by required conditions
CI / build-rpi2040 (push) Blocked by required conditions
CI / build-stm32 (push) Blocked by required conditions
CI / build-debian-src (push) Waiting to run
CI / package-pio-deps-native-tft (push) Waiting to run
CI / test-native (push) Waiting to run
CI / docker-debian-amd64 (push) Waiting to run
CI / docker-alpine-amd64 (push) Waiting to run
CI / docker-debian-arm64 (push) Waiting to run
CI / docker-debian-armv7 (push) Waiting to run
CI / after-checks (push) Blocked by required conditions
CI / gather-artifacts (esp32) (push) Blocked by required conditions
CI / gather-artifacts (esp32c3) (push) Blocked by required conditions
CI / gather-artifacts (esp32c6) (push) Blocked by required conditions
CI / gather-artifacts (esp32s3) (push) Blocked by required conditions
CI / gather-artifacts (nrf52840) (push) Blocked by required conditions
CI / gather-artifacts (rp2040) (push) Blocked by required conditions
CI / gather-artifacts (stm32) (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
CI / release-firmware (esp32) (push) Blocked by required conditions
CI / release-firmware (esp32c3) (push) Blocked by required conditions
CI / release-firmware (esp32c6) (push) Blocked by required conditions
CI / release-firmware (esp32s3) (push) Blocked by required conditions
CI / release-firmware (nrf52840) (push) Blocked by required conditions
CI / release-firmware (rp2040) (push) Blocked by required conditions
CI / release-firmware (stm32) (push) Blocked by required conditions
* Added initial support for Texas Instrument LP5562 * Added proper support for Ambient Lighting * Code merge for all RBG_LED enabled devices * Fixed forgotten log_info & added firstRGBLED()
This commit is contained in:
parent
644849126c
commit
f6ed10f329
@ -6,6 +6,11 @@
|
|||||||
NCP5623 rgb;
|
NCP5623 rgb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
#include <graphics/NomadStarLED.h>
|
||||||
|
LP5562 rgbw;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
#include <graphics/NeoPixel.h>
|
#include <graphics/NeoPixel.h>
|
||||||
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE);
|
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE);
|
||||||
@ -26,7 +31,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
notifyDeepSleepObserver.observe(¬ifyDeepSleep); // Let us know when shutdown() is issued.
|
notifyDeepSleepObserver.observe(¬ifyDeepSleep); // Let us know when shutdown() is issued.
|
||||||
|
|
||||||
// Enables Ambient Lighting by default if conditions are meet.
|
// Enables Ambient Lighting by default if conditions are meet.
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#ifdef HAS_RGB_LED
|
||||||
#ifdef ENABLE_AMBIENTLIGHTING
|
#ifdef ENABLE_AMBIENTLIGHTING
|
||||||
moduleConfig.ambient_lighting.led_state = true;
|
moduleConfig.ambient_lighting.led_state = true;
|
||||||
#endif
|
#endif
|
||||||
@ -39,7 +44,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
// moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
// moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
||||||
// moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
// moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
||||||
|
|
||||||
#ifdef HAS_NCP5623
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
_type = type;
|
_type = type;
|
||||||
if (_type == ScanI2C::DeviceType::NONE) {
|
if (_type == ScanI2C::DeviceType::NONE) {
|
||||||
LOG_DEBUG("AmbientLighting Disable due to no RGB leds found on I2C bus");
|
LOG_DEBUG("AmbientLighting Disable due to no RGB leds found on I2C bus");
|
||||||
@ -47,17 +52,21 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#ifdef HAS_RGB_LED
|
||||||
if (!moduleConfig.ambient_lighting.led_state) {
|
if (!moduleConfig.ambient_lighting.led_state) {
|
||||||
LOG_DEBUG("AmbientLighting Disable due to moduleConfig.ambient_lighting.led_state OFF");
|
LOG_DEBUG("AmbientLighting Disable due to moduleConfig.ambient_lighting.led_state OFF");
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("AmbientLighting init");
|
LOG_DEBUG("AmbientLighting init");
|
||||||
#ifdef HAS_NCP5623
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
if (_type == ScanI2C::NCP5623) {
|
if (_type == ScanI2C::NCP5623) {
|
||||||
rgb.begin();
|
rgb.begin();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
} else if (_type == ScanI2C::LP5562) {
|
||||||
|
rgbw.begin();
|
||||||
|
#endif
|
||||||
#ifdef RGBLED_RED
|
#ifdef RGBLED_RED
|
||||||
pinMode(RGBLED_RED, OUTPUT);
|
pinMode(RGBLED_RED, OUTPUT);
|
||||||
pinMode(RGBLED_GREEN, OUTPUT);
|
pinMode(RGBLED_GREEN, OUTPUT);
|
||||||
@ -70,7 +79,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
#endif
|
#endif
|
||||||
setLighting();
|
setLighting();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_NCP5623
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -78,13 +87,13 @@ 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_RGB_LED
|
||||||
#ifdef HAS_NCP5623
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
|
if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) {
|
||||||
#endif
|
#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
|
||||||
#ifdef HAS_NCP5623
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -108,6 +117,14 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
rgb.setBlue(0);
|
rgb.setBlue(0);
|
||||||
LOG_INFO("OFF: NCP5623 Ambient lighting");
|
LOG_INFO("OFF: NCP5623 Ambient lighting");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
rgbw.setCurrent(0);
|
||||||
|
rgbw.setRed(0);
|
||||||
|
rgbw.setGreen(0);
|
||||||
|
rgbw.setBlue(0);
|
||||||
|
rgbw.setWhite(0);
|
||||||
|
LOG_INFO("OFF: LP5562 Ambient lighting");
|
||||||
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.clear();
|
pixels.clear();
|
||||||
pixels.show();
|
pixels.show();
|
||||||
@ -141,6 +158,14 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
||||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
rgbw.setCurrent(moduleConfig.ambient_lighting.current);
|
||||||
|
rgbw.setRed(moduleConfig.ambient_lighting.red);
|
||||||
|
rgbw.setGreen(moduleConfig.ambient_lighting.green);
|
||||||
|
rgbw.setBlue(moduleConfig.ambient_lighting.blue);
|
||||||
|
LOG_DEBUG("Init LP5562 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
||||||
|
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||||
moduleConfig.ambient_lighting.blue),
|
moduleConfig.ambient_lighting.blue),
|
||||||
|
@ -170,6 +170,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// LED
|
// LED
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#define NCP5623_ADDR 0x38
|
#define NCP5623_ADDR 0x38
|
||||||
|
#define LP5562_ADDR 0x30
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Security
|
// Security
|
||||||
@ -295,6 +296,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#error HW_VENDOR must be defined
|
#error HW_VENDOR must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Support multiple RGB LED configuration
|
||||||
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||||
|
#define HAS_RGB_LED
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Global switches to turn off features for a minimized build
|
// Global switches to turn off features for a minimized build
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -41,6 +41,12 @@ ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
|||||||
return firstOfOrNONE(8, types);
|
return firstOfOrNONE(8, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScanI2C::FoundDevice ScanI2C::firstRGBLED() const
|
||||||
|
{
|
||||||
|
ScanI2C::DeviceType types[] = {NCP5623, LP5562};
|
||||||
|
return firstOfOrNONE(2, types);
|
||||||
|
}
|
||||||
|
|
||||||
ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const
|
ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const
|
||||||
{
|
{
|
||||||
return DEVICE_NONE;
|
return DEVICE_NONE;
|
||||||
|
@ -49,6 +49,7 @@ class ScanI2C
|
|||||||
VEML7700,
|
VEML7700,
|
||||||
RCWL9620,
|
RCWL9620,
|
||||||
NCP5623,
|
NCP5623,
|
||||||
|
LP5562,
|
||||||
TSL2591,
|
TSL2591,
|
||||||
OPT3001,
|
OPT3001,
|
||||||
MLX90632,
|
MLX90632,
|
||||||
@ -121,6 +122,8 @@ class ScanI2C
|
|||||||
|
|
||||||
FoundDevice firstAccelerometer() const;
|
FoundDevice firstAccelerometer() const;
|
||||||
|
|
||||||
|
FoundDevice firstRGBLED() const;
|
||||||
|
|
||||||
virtual FoundDevice find(DeviceType) const;
|
virtual FoundDevice find(DeviceType) const;
|
||||||
|
|
||||||
virtual bool exists(DeviceType) const;
|
virtual bool exists(DeviceType) const;
|
||||||
|
@ -218,6 +218,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address);
|
||||||
|
#endif
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address)
|
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address)
|
||||||
#endif
|
#endif
|
||||||
|
5
src/graphics/NomadStarLED.h
Normal file
5
src/graphics/NomadStarLED.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#ifdef HAS_LP5562
|
||||||
|
#include <LP5562.h>
|
||||||
|
extern LP5562 rgbw;
|
||||||
|
|
||||||
|
#endif
|
@ -602,9 +602,9 @@ void setup()
|
|||||||
* "found".
|
* "found".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Only one supported RGB LED currently
|
// Two supported RGB LED currently
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_RGB_LED
|
||||||
rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
|
rgb_found = i2cScanner->firstRGBLED();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_TPS65233
|
#ifdef HAS_TPS65233
|
||||||
@ -1270,7 +1270,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
|
|||||||
#ifndef ARCH_ESP32
|
#ifndef ARCH_ESP32
|
||||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_PAXCOUNTER_CONFIG;
|
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_PAXCOUNTER_CONFIG;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAS_NCP5623) && !defined(RGBLED_RED) && !defined(HAS_NEOPIXEL) && !defined(UNPHONE) && !RAK_4631
|
#if !defined(HAS_RGB_LED) && !RAK_4631
|
||||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG;
|
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include <graphics/RAKled.h>
|
#include <graphics/RAKled.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
#include <graphics/NomadStarLED.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
#include <graphics/NeoPixel.h>
|
#include <graphics/NeoPixel.h>
|
||||||
#endif
|
#endif
|
||||||
@ -37,10 +41,11 @@
|
|||||||
extern unPhone unphone;
|
extern unPhone unphone;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_RGB_LED)
|
||||||
uint8_t red = 0;
|
uint8_t red = 0;
|
||||||
uint8_t green = 0;
|
uint8_t green = 0;
|
||||||
uint8_t blue = 0;
|
uint8_t blue = 0;
|
||||||
|
uint8_t white = 0;
|
||||||
uint8_t colorState = 1;
|
uint8_t colorState = 1;
|
||||||
uint8_t brightnessIndex = 0;
|
uint8_t brightnessIndex = 0;
|
||||||
uint8_t brightnessValues[] = {0, 10, 20, 30, 50, 90, 160, 170}; // blue gets multiplied by 1.5
|
uint8_t brightnessValues[] = {0, 10, 20, 30, 50, 90, 160, 170}; // blue gets multiplied by 1.5
|
||||||
@ -128,15 +133,21 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
millis());
|
millis());
|
||||||
setExternalState(2, !getExternal(2));
|
setExternalState(2, !getExternal(2));
|
||||||
}
|
}
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_RGB_LED)
|
||||||
red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7
|
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
|
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
|
blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7
|
||||||
|
white = (colorState & 12) ? brightnessValues[brightnessIndex] : 0;
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
if (rgb_found.type == ScanI2C::NCP5623) {
|
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||||
rgb.setColor(red, green, blue);
|
rgb.setColor(red, green, blue);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
if (rgb_found.type == ScanI2C::LP5562) {
|
||||||
|
rgbw.setColor(red, green, blue, white);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef RGBLED_CA
|
#ifdef RGBLED_CA
|
||||||
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
|
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
|
||||||
analogWrite(RGBLED_GREEN, 255 - green);
|
analogWrite(RGBLED_GREEN, 255 - green);
|
||||||
@ -233,11 +244,12 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_RGB_LED)
|
||||||
if (!on) {
|
if (!on) {
|
||||||
red = 0;
|
red = 0;
|
||||||
green = 0;
|
green = 0;
|
||||||
blue = 0;
|
blue = 0;
|
||||||
|
white = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -246,6 +258,11 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on)
|
|||||||
rgb.setColor(red, green, blue);
|
rgb.setColor(red, green, blue);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
if (rgb_found.type == ScanI2C::LP5562) {
|
||||||
|
rgbw.setColor(red, green, blue, white);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef RGBLED_CA
|
#ifdef RGBLED_CA
|
||||||
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
|
analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic
|
||||||
analogWrite(RGBLED_GREEN, 255 - green);
|
analogWrite(RGBLED_GREEN, 255 - green);
|
||||||
@ -365,6 +382,12 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
rgb.setCurrent(10);
|
rgb.setCurrent(10);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_LP5562
|
||||||
|
if (rgb_found.type == ScanI2C::LP5562) {
|
||||||
|
rgbw.begin();
|
||||||
|
rgbw.setCurrent(20);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef RGBLED_RED
|
#ifdef RGBLED_RED
|
||||||
pinMode(RGBLED_RED, OUTPUT); // set up the RGB led pins
|
pinMode(RGBLED_RED, OUTPUT); // set up the RGB led pins
|
||||||
pinMode(RGBLED_GREEN, OUTPUT);
|
pinMode(RGBLED_GREEN, OUTPUT);
|
||||||
|
Loading…
Reference in New Issue
Block a user