1+ /*
2+ | Name | Bit 0 | Bit 0 | Bit 1 | Bit 1 | Reset | Color |
3+ | | Duration 1 | Duration 2 | Duration 1 | Duration 2 | Duration | Order |
4+ |:--------|:----------:|:----------:|:----------:|:----------:|:---------:|:-----:|
5+ | APA105 | 300 | -900 | 600 | -600 | -80000 | GRB |
6+ | APA109 | 300 | -900 | 600 | -600 | -80000 | GRB |
7+ | SK6805 | 300 | -900 | 600 | -600 | -80000 | GRB |
8+ | SK6812 | 300 | -900 | 600 | -600 | -80000 | GRB |
9+ | SK6818 | 300 | -900 | 600 | -600 | -80000 | GRB |
10+ | WS2813 | 300 | -300 | 750 | -300 | -300000 | GRB |
11+ | APA104 | 350 | -1360 | 1360 | -350 | -24000 | RGB |
12+ | SK6822 | 350 | -1360 | 1360 | -350 | -50000 | RGB |
13+ | WS2812 | 350 | -800 | 700 | -600 | -50000 | GRB |
14+ | WS2818A | 220 | -580 | 580 | -220 | -280000 | RGB |
15+ | WS2818B | 220 | -580 | 580 | -220 | -280000 | RGB |
16+ | WS2851 | 220 | -580 | 580 | -220 | -280000 | RGB |
17+ | WS2815B | 220 | -580 | 580 | -220 | -280000 | RGB |
18+ | WS2815 | 220 | -580 | 580 | -220 | -280000 | RGB |
19+ | WS2811 | 220 | -580 | 580 | -220 | -280000 | RGB |
20+ | WS2814 | 220 | -580 | 580 | -220 | -280000 | RGB |
21+ | WS2818 | 220 | -750 | 750 | -220 | -300000 | RGB |
22+ | WS2816A | 220 | -580 | 580 | -580 | -280000 | GRB |
23+ | WS2816B | 200 | -800 | 520 | -480 | -280000 | GRB |
24+ | WS2816C | 200 | -800 | 520 | -480 | -280000 | GRB |
25+ | WS2812B | 400 | -850 | 800 | -450 | -50000 | GRB |
26+ | SK6813 | 240 | -800 | 740 | -200 | -80000 | GRB |
27+ */
28+
29+ #ifndef __LED_STRIP_H__
30+ #define __LED_STRIP_H__
31+
32+ #include "driver/rmt_tx.h"
33+ #include "led_strip_encoder.h"
34+
35+ #include "freertos/FreeRTOS.h"
36+ #include "freertos/task.h"
37+ #include "freertos/semphr.h"
38+ #include "freertos/idf_additions.h"
39+
40+ // micropython includes
41+ #include "py/obj.h"
42+ #include "py/runtime.h"
43+ #include "py/objarray.h"
44+
45+ typedef enum _led_strip_ic_t {
46+ CUSTOM = 0 ,
47+
48+ APA105 = 1 ,
49+ APA109 = 1 ,
50+ SK6805 = 1 ,
51+ SK6812 = 1 ,
52+ SK6818 = 1 ,
53+
54+ WS2813 = 2 ,
55+ APA104 = 3 ,
56+ SK6822 = 4 ,
57+ WS2812 = 5 ,
58+
59+ WS2818A = 6 ,
60+ WS2818B = 6 ,
61+ WS2851 = 6 ,
62+ WS2815B = 6 ,
63+ WS2815 = 6 ,
64+ WS2811 = 6 ,
65+ WS2814 = 6 ,
66+
67+ WS2818 = 7 ,
68+ WS2816A = 8 ,
69+
70+ WS2816B = 9 ,
71+ WS2816C = 9 ,
72+
73+ WS2812B = 10 ,
74+ SK6813 = 11 ,
75+
76+ } led_strip_ic_t ;
77+
78+ typedef struct {
79+ SemaphoreHandle_t handle ;
80+ StaticSemaphore_t buffer ;
81+ } lock_t ;
82+
83+ typedef struct _mp_led_strip_obj_t {
84+ mp_obj_base_t base ;
85+
86+ mp_obj_t callback ;
87+
88+ mp_obj_array_t * * buffers ;
89+ uint8_t buffer_count : 4 ;
90+
91+ mp_obj_array_t * * buffers_in_queue ;
92+ uint8_t queue_buffer_count : 4 ;
93+
94+ uint16_t num_pixels : 12 ;
95+ uint16_t is_init : 1 ;
96+ uint16_t bpp : 3 ;
97+
98+ rmt_encoder_handle_t encoder_handle ;
99+ rmt_channel_handle_t channel_handle ;
100+ led_strip_encoder_config_t encoder_config ;
101+ rmt_tx_channel_config_t channel_config ;
102+ lock_t tx_lock ;
103+ lock_t task_lock ;
104+ TaskHandle_t task_handle ;
105+
106+ } mp_led_strip_obj_t ;
107+
108+ extern const mp_obj_type_t mp_led_strip_type ;
109+
110+ #endif
0 commit comments