This commit is contained in:
DefenderOfHyrule 2024-07-07 23:33:46 +02:00
parent cae7779fa1
commit 5617e8cfec
2 changed files with 11 additions and 1 deletions

7
misc.c
View file

@ -116,7 +116,12 @@ void put_pixel(uint32_t pixel_grb)
gpio_put(pwr_pin(), 1); gpio_put(pwr_pin(), 1);
sleep_us(200); sleep_us(200);
} }
pio_sm_put_blocking(pio0, 3, pixel_grb << 8u);
uint8_t green = (pixel_grb >> 16) & 0xFF;
uint8_t red = (pixel_grb >> 8) & 0xFF;
uint8_t blue = pixel_grb & 0xFF;
pio_sm_put_blocking(pio0, 3, (green << 16) | (red << 8) | blue);
sleep_us(50); sleep_us(50);
pio_sm_set_enabled(pio0, 3, false); pio_sm_set_enabled(pio0, 3, false);
gpio_init(led_pin()); gpio_init(led_pin());

5
misc.h
View file

@ -6,6 +6,11 @@
void put_pixel(uint32_t pixel_grb); void put_pixel(uint32_t pixel_grb);
uint8_t red = (pixel_grb >> 8) & 0xFF;
uint8_t green = (pixel_grb >> 16) & 0xFF;
uint8_t blue = pixel_grb & 0xFF;
void halt_with_error(uint32_t err, uint32_t bits); void halt_with_error(uint32_t err, uint32_t bits);
void gpio_disable_input_output(int pin); void gpio_disable_input_output(int pin);