Use logic LOW when not sending data.

This commit is contained in:
Derek Jamison 2024-01-17 10:24:28 -06:00
parent 9ec25ed0b4
commit fe3bb3b354

View File

@ -23,6 +23,7 @@
#define LED_DRIVER_T0L 850U
#define LED_DRIVER_T1L 450U
#define LED_DRIVER_TRESETL 55 * 1000U
#define LED_DRIVER_TDONE 2000U
// Wait for 35ms for the DMA to complete. NOTE: 1000 leds*(850ns+450ns)*24 = 32ms
#define LED_DRIVER_SETINEL_WAIT_MS 35
@ -250,18 +251,18 @@ void led_driver_transmit(LedDriver* led_driver, bool transmit_if_clean) {
const uint32_t bit_set = led_driver->gpio->pin << GPIO_BSRR_BS0_Pos;
const uint32_t bit_reset = led_driver->gpio->pin << GPIO_BSRR_BR0_Pos;
// Always start with LOW (reset)
led_driver->gpio_buf[0] = bit_reset;
led_driver->gpio_buf[1] = bit_set;
// Our initial state is LOW, so first pulse is HIGH (set)
led_driver->gpio_buf[0] = bit_set;
led_driver->gpio_buf[1] = bit_reset;
for(size_t i = 0; i < LED_DRIVER_BUFFER_SIZE; i++) {
led_driver->timer_buffer[i] = LED_DRIVER_TIMER_SETINEL;
}
led_driver_add_period(led_driver, LED_DRIVER_TRESETL);
for(size_t i = 0; i < led_driver->count_leds; i++) {
led_driver_add_color(led_driver, led_driver->led_data[i]);
}
led_driver_add_period(led_driver, LED_DRIVER_TDONE);
led_driver->dma_led_transition_timer.NbData = led_driver->write_pos + 1;
FURI_CRITICAL_ENTER();