Skip to content

Commit

Permalink
update led tester
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Jan 20, 2024
1 parent f0fabb6 commit 8f510d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions non_catalog_apps/ws2812b_tester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ This application has three submenu items:
The "About" menu item contains information about the application.

# Updates
- Version 1.9
- Use logic LOW instead of HIGH as resting state. Fixes first LED was "laggy" issue.
- Version 1.8
- Renamed app to fit on Flipper Zero main menu screen
- Improved initialization to only happen when configuring the LEDs
Expand Down
2 changes: 1 addition & 1 deletion non_catalog_apps/ws2812b_tester/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ App(
name="[WS2812B] LED Tester",
apptype=FlipperAppType.EXTERNAL,
entry_point="ws2812b_led_tester_app",
fap_version=(1, 8),
fap_version=(1, 9),
stack_size=4 * 1024,
requires=[
"gui",
Expand Down
9 changes: 5 additions & 4 deletions non_catalog_apps/ws2812b_tester/led_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 8f510d6

Please sign in to comment.