From 2a7d921d1a7098937d610a0f6b327774dd71f3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 18 Feb 2016 11:34:08 +0100 Subject: [PATCH] add clock hours mark demo --- main.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 8c19336..7f35a17 100644 --- a/main.c +++ b/main.c @@ -35,8 +35,10 @@ #include "usb_cdcacm.h" // USB CDC ACM utilities #include "led_ws2812b.h" // WS2812b LEDs utilities -/* flag set in interrupts to be processed in main taks */ -volatile bool button_flag = false; // button has been presse +/* flag set in interrupts to be processed in main task */ +volatile bool button_flag = false; // button has been pressed + +uint8_t clock_leds[WS2812B_LEDS*3] = {0}; // RGB values for the WS2812b clock LEDs /* default output (i.e. for printf) */ int _write(int file, char *ptr, int len) @@ -84,6 +86,34 @@ void led_toggle(void) gpio_toggle(LED_PORT, LED_PIN); } +/* switch off all clock LEDs */ +static void leds_clear(void) +{ + // set all colors of all LEDs to 0 + for (uint16_t i=0; i