mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-12 13:28:15 +02:00
Add PHY option to keep LED steady.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#define PHY_OPT_WCID 0x1
|
#define PHY_OPT_WCID 0x1
|
||||||
#define PHY_OPT_DIMM 0x2
|
#define PHY_OPT_DIMM 0x2
|
||||||
#define PHY_OPT_DISABLE_POWER_RESET 0x4
|
#define PHY_OPT_DISABLE_POWER_RESET 0x4
|
||||||
|
#define PHY_OPT_LED_STEADY 0x8
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ void led_blinking_task() {
|
|||||||
uint32_t led_off = (led_mode & LED_OFF_MASK) >> LED_OFF_SHIFT;
|
uint32_t led_off = (led_mode & LED_OFF_MASK) >> LED_OFF_SHIFT;
|
||||||
uint32_t led_on = (led_mode & LED_ON_MASK) >> LED_ON_SHIFT;
|
uint32_t led_on = (led_mode & LED_ON_MASK) >> LED_ON_SHIFT;
|
||||||
|
|
||||||
// how far in the current state from 0 - 1
|
|
||||||
float progress = 0;
|
float progress = 0;
|
||||||
|
|
||||||
if (stop_ms > start_ms) {
|
if (stop_ms > start_ms) {
|
||||||
@@ -57,13 +56,11 @@ void led_blinking_task() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// fading down so 1 -> 0
|
|
||||||
progress = 1. - progress;
|
progress = 1. - progress;
|
||||||
}
|
}
|
||||||
|
if (phy_data.opts & PHY_OPT_LED_STEADY) {
|
||||||
// maybe quick return if progress didn't changed much ?
|
progress = 1;
|
||||||
|
}
|
||||||
// current one from 0 - 1
|
|
||||||
|
|
||||||
led_driver_color(led_color, led_brightness, progress);
|
led_driver_color(led_color, led_brightness, progress);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user