mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-27 00:25:11 +02:00
Refactor PHY to support more flexible and scalable architecture.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -31,9 +31,6 @@ extern void led_driver_color(uint8_t, uint32_t, float);
|
||||
|
||||
static uint32_t led_mode = MODE_NOT_MOUNTED;
|
||||
|
||||
uint32_t led_phy_btness = MAX_BTNESS;
|
||||
bool led_dimmable = false;
|
||||
|
||||
void led_set_mode(uint32_t mode) {
|
||||
led_mode = mode;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,4 @@ extern void led_blinking_task();
|
||||
extern void led_off_all();
|
||||
extern void led_init();
|
||||
|
||||
extern uint32_t led_phy_btness;
|
||||
extern bool led_dimmable;
|
||||
|
||||
#endif // _LED_H_
|
||||
|
||||
@@ -47,9 +47,10 @@ void led_driver_init() {
|
||||
|
||||
void led_driver_color(uint8_t color, uint32_t led_brightness, float progress) {
|
||||
static tNeopixel spx = {.index = 0, .rgb = 0};
|
||||
if (!led_dimmable) {
|
||||
if (!(phy_data.opts & PHY_OPT_DIMM)) {
|
||||
progress = progress >= 0.5 ? 1 : 0;
|
||||
}
|
||||
uint32_t led_phy_btness = phy_data.led_brightness_present ? phy_data.led_brightness : MAX_BTNESS;
|
||||
float brightness = ((float)led_brightness / MAX_BTNESS) * ((float)led_phy_btness / MAX_BTNESS) * progress;
|
||||
uint32_t pixel_color = pixel[color].rgb;
|
||||
uint8_t r = (pixel_color >> 16) & 0xFF;
|
||||
|
||||
@@ -80,9 +80,11 @@ uint32_t pixel[] = {
|
||||
};
|
||||
|
||||
void led_driver_color(uint8_t color, uint32_t led_brightness, float progress) {
|
||||
if (!led_dimmable) {
|
||||
if (!(phy_data.opts & PHY_OPT_DIMM)) {
|
||||
progress = progress >= 0.5 ? 1 : 0;
|
||||
}
|
||||
uint32_t led_phy_btness = phy_data.led_brightness_present ? phy_data.led_brightness : MAX_BTNESS;
|
||||
|
||||
float brightness = ((float)led_brightness / MAX_BTNESS) * ((float)led_phy_btness / MAX_BTNESS) * progress;
|
||||
uint32_t pixel_color = pixel[color];
|
||||
uint8_t r = (pixel_color >> 16) & 0xFF;
|
||||
|
||||
Reference in New Issue
Block a user