Merge branch 'main' of https://github.com/jamisonderek/flipper-zero-tutorials
This commit is contained in:
commit
7e4d4a06cb
@ -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
|
||||
|
@ -168,10 +168,9 @@ static void led_tester_setting_led_pin_change(VariableItem* item) {
|
||||
|
||||
// Settings for configuring how many LEDs to enable.
|
||||
static const char* setting_led_count_config_label = "LED Count";
|
||||
static uint16_t setting_led_count_values[] =
|
||||
{1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 256, 512, 1024};
|
||||
static uint16_t setting_led_count_values[] = {1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 256, 512};
|
||||
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 void led_tester_setting_led_count_change(VariableItem* 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_transmit(app->led_driver, false);
|
||||
led_driver_transmit(app->led_driver, true);
|
||||
|
||||
if(event == LedTesterEventDeinit) {
|
||||
led_driver_free(app->led_driver);
|
||||
|
@ -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",
|
||||
|
@ -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();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define MAX_LED_COUNT 1024
|
||||
#define MAX_LED_COUNT 512
|
||||
|
||||
typedef struct LedDriver LedDriver;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user