Déplacement des leds sur le pio1
This commit is contained in:
parent
d2552f198b
commit
60d89f1c18
9
ws2812.c
9
ws2812.c
@ -13,6 +13,8 @@
|
|||||||
uint32_t couleur[13];
|
uint32_t couleur[13];
|
||||||
uint32_t buffer_couleur[12];
|
uint32_t buffer_couleur[12];
|
||||||
|
|
||||||
|
PIO pio;
|
||||||
|
|
||||||
struct ws2812_type_gestion_t
|
struct ws2812_type_gestion_t
|
||||||
{
|
{
|
||||||
enum led_type_gestion_t led_type_gestion;
|
enum led_type_gestion_t led_type_gestion;
|
||||||
@ -66,7 +68,7 @@ void ws2812_init(){
|
|||||||
couleur[12]=0x00FF00;*/
|
couleur[12]=0x00FF00;*/
|
||||||
|
|
||||||
// initialisation du PIO
|
// initialisation du PIO
|
||||||
PIO pio = pio0;
|
pio = pio1;
|
||||||
int sm = 0;
|
int sm = 0;
|
||||||
uint offset = pio_add_program(pio, &ws2812_program);
|
uint offset = pio_add_program(pio, &ws2812_program);
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ void ws2812_arc_en_ciel(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void put_pixel(uint32_t pixel_grb) {
|
static inline void put_pixel(uint32_t pixel_grb) {
|
||||||
pio_sm_put_blocking(pio0, 0, pixel_grb << 8u);
|
pio_sm_put_blocking(pio, 0, pixel_grb << 8u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t urgb_u32(uint8_t r, uint8_t g, uint8_t b) {
|
static inline uint32_t urgb_u32(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
@ -208,12 +210,9 @@ void ws2812_gestion(void){
|
|||||||
temps_ref =100000;
|
temps_ref =100000;
|
||||||
nb_cli = 1;
|
nb_cli = 1;
|
||||||
phase_led =(get_absolute_time() / temps_ref) % (nb_cli*2 + 4) ;
|
phase_led =(get_absolute_time() / temps_ref) % (nb_cli*2 + 4) ;
|
||||||
printf(">l:%d\n", phase_led);
|
|
||||||
if(phase_led >= nb_cli*2){
|
if(phase_led >= nb_cli*2){
|
||||||
ws2812_set_buffer(0x000000, led_id);
|
ws2812_set_buffer(0x000000, led_id);
|
||||||
}else{
|
}else{
|
||||||
printf(">l1:%d\n",phase_led );
|
|
||||||
|
|
||||||
if(phase_led % 2){
|
if(phase_led % 2){
|
||||||
ws2812_set_buffer(ws2812_type_gestion[led_id].couleur, led_id);
|
ws2812_set_buffer(ws2812_type_gestion[led_id].couleur, led_id);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user