From f189bf66667657985a97673bd5c2a54da3f8f39e Mon Sep 17 00:00:00 2001 From: ch2g21 <ch2g21@soton.ac.uk> Date: Tue, 9 May 2023 12:03:53 +0000 Subject: [PATCH] added stub --- Stub/.gitkeep | 0 Stub/neoPixel.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) delete mode 100644 Stub/.gitkeep create mode 100644 Stub/neoPixel.c diff --git a/Stub/.gitkeep b/Stub/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Stub/neoPixel.c b/Stub/neoPixel.c new file mode 100644 index 0000000..7a03aca --- /dev/null +++ b/Stub/neoPixel.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "pico/stdlib.h" +#include "hardware/pio.h" +#include "hardware/clocks.h" +#include "ws2812.pio.h" + +#define GPIO 28 + +static inline void setPixel(uint32_t pixel_grb) { + pio_sm_put_blocking(pio0, 0, pixel_grb * 256); +} + + //Todo make function which call a loop which fades from one clour to another + //use setPixel + //first 256 for white + //second 256 for green + //third 256 for red + //forth 256 for blue + +int main() { + stdio_init_all(); + uint offset = pio_add_program(pio0, &ws2812_program); + ws2812_program_init(pio0, 0, offset, GPIO, 800000, true); + while (1) { + //call subroutine + } +} -- GitLab