This commit is contained in:
Derek Jamison 2024-01-20 13:58:34 -06:00
commit 7e4d4a06cb
5 changed files with 12 additions and 10 deletions

View File

@ -23,6 +23,8 @@ This application has three submenu items:
The "About" menu item contains information about the application. The "About" menu item contains information about the application.
# Updates # Updates
- Version 1.9
- Use logic LOW instead of HIGH as resting state. Fixes first LED was "laggy" issue.
- Version 1.8 - Version 1.8
- Renamed app to fit on Flipper Zero main menu screen - Renamed app to fit on Flipper Zero main menu screen
- Improved initialization to only happen when configuring the LEDs - Improved initialization to only happen when configuring the LEDs

View File

@ -168,10 +168,9 @@ static void led_tester_setting_led_pin_change(VariableItem* item) {
// Settings for configuring how many LEDs to enable. // Settings for configuring how many LEDs to enable.
static const char* setting_led_count_config_label = "LED Count"; static const char* setting_led_count_config_label = "LED Count";
static uint16_t setting_led_count_values[] = static uint16_t setting_led_count_values[] = {1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 256, 512};
{1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 256, 512, 1024};
static char* setting_led_count_names[] = static char* setting_led_count_names[] =
{"1", "2", "3", "4", "5", "6", "7", "8", "16", "32", "64", "128", "256", "512", "1024"}; {"1", "2", "3", "4", "5", "6", "7", "8", "16", "32", "64", "128", "256", "512"};
static uint8_t setting_led_count_default_index = 3; // 4 LEDs static uint8_t setting_led_count_default_index = 3; // 4 LEDs
static void led_tester_setting_led_count_change(VariableItem* item) { static void led_tester_setting_led_count_change(VariableItem* item) {
LedTesterApp* app = variable_item_get_context(item); LedTesterApp* app = variable_item_get_context(item);
@ -347,7 +346,7 @@ static bool led_tester_custom_event_callback(void* context, uint32_t event) {
led_driver_set_led(app->led_driver, i, 0); led_driver_set_led(app->led_driver, i, 0);
} }
led_driver_transmit(app->led_driver, false); led_driver_transmit(app->led_driver, true);
if(event == LedTesterEventDeinit) { if(event == LedTesterEventDeinit) {
led_driver_free(app->led_driver); led_driver_free(app->led_driver);

View File

@ -3,7 +3,7 @@ App(
name="WS2812B LED Tester", name="WS2812B LED Tester",
apptype=FlipperAppType.EXTERNAL, apptype=FlipperAppType.EXTERNAL,
entry_point="ws2812b_led_tester_app", entry_point="ws2812b_led_tester_app",
fap_version=(1, 8), fap_version=(1, 9),
stack_size=4 * 1024, stack_size=4 * 1024,
requires=[ requires=[
"gui", "gui",

View File

@ -23,6 +23,7 @@
#define LED_DRIVER_T0L 850U #define LED_DRIVER_T0L 850U
#define LED_DRIVER_T1L 450U #define LED_DRIVER_T1L 450U
#define LED_DRIVER_TRESETL 55 * 1000U #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 // Wait for 35ms for the DMA to complete. NOTE: 1000 leds*(850ns+450ns)*24 = 32ms
#define LED_DRIVER_SETINEL_WAIT_MS 35 #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_set = led_driver->gpio->pin << GPIO_BSRR_BS0_Pos;
const uint32_t bit_reset = led_driver->gpio->pin << GPIO_BSRR_BR0_Pos; const uint32_t bit_reset = led_driver->gpio->pin << GPIO_BSRR_BR0_Pos;
// Always start with LOW (reset) // Our initial state is LOW, so first pulse is HIGH (set)
led_driver->gpio_buf[0] = bit_reset; led_driver->gpio_buf[0] = bit_set;
led_driver->gpio_buf[1] = bit_set; led_driver->gpio_buf[1] = bit_reset;
for(size_t i = 0; i < LED_DRIVER_BUFFER_SIZE; i++) { for(size_t i = 0; i < LED_DRIVER_BUFFER_SIZE; i++) {
led_driver->timer_buffer[i] = LED_DRIVER_TIMER_SETINEL; 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++) { 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_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; led_driver->dma_led_transition_timer.NbData = led_driver->write_pos + 1;
FURI_CRITICAL_ENTER(); FURI_CRITICAL_ENTER();

View File

@ -1,7 +1,7 @@
#include <furi.h> #include <furi.h>
#include <furi_hal.h> #include <furi_hal.h>
#define MAX_LED_COUNT 1024 #define MAX_LED_COUNT 512
typedef struct LedDriver LedDriver; typedef struct LedDriver LedDriver;