feat(pl18): Power LED charge status animation (#4503)

This commit is contained in:
richardclli
2024-01-05 10:13:06 +10:00
committed by GitHub
parent 2d877d4408
commit b2c9b93f4c
2 changed files with 67 additions and 44 deletions
+14 -7
View File
@@ -50,9 +50,12 @@
#include <string.h>
// common ADC driver
// Common ADC driver
extern const etx_hal_adc_driver_t _adc_driver;
// Common LED driver
extern const stm32_pulse_timer_t _led_timer;
#if defined(SEMIHOSTING)
extern "C" void initialise_monitor_handles();
#endif
@@ -88,6 +91,14 @@ void delay_self(int count)
#define RCC_APB2PeriphMinimum (LCD_RCC_APB2Periph)
#define RCC_APB2PeriphOther (HAPTIC_RCC_APB2Periph)
void ledStripOff()
{
for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) {
ws2812_set_color(i, 0, 0, 0);
}
ws2812_update(&_led_timer);
}
void boardInit()
{
#if defined(SEMIHOSTING)
@@ -123,13 +134,8 @@ void boardInit()
touchPanelInit();
usbInit();
extern const stm32_pulse_timer_t _led_timer;
ws2812_init(&_led_timer, LED_STRIP_LENGTH);
for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) {
ws2812_set_color(i, 0, 0, 0);
}
ws2812_update(&_led_timer);
ledStripOff();
uint32_t press_start = 0;
uint32_t press_end = 0;
@@ -204,6 +210,7 @@ void boardOff()
rtcDisableBackupReg();
#if !defined(BOOT)
ledStripOff();
if (isChargerActive())
{
delay_ms(100); // Add a delay to wait for lcdOff