From eb8094f2fb39dc8ad7b6cd4e79544cb268cb9e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Fri, 25 Mar 2016 20:24:46 +0100 Subject: [PATCH] use 4096 Hz square wave --- main.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index 83be351..e8deff7 100644 --- a/main.c +++ b/main.c @@ -50,7 +50,7 @@ volatile bool button_flag = false; /**< flag set if board user button has been p /** @} */ #define TICKS_PER_SECOND 256 /**< the number of ticks in one second */ -#define SQUARE_WAVE_FREQUENCY 1 /**< square wave output frequency from the RTC IC */ +#define SQUARE_WAVE_FREQUENCY 4096 /**< square wave output frequency from the RTC IC */ /** @defgroup main_ticks ticks per time units * @note these are derived from TICKS_PER_SECOND * @note I have to use type variables because defines would be stored in signed integers, leading to an overflow it later calculations @@ -223,10 +223,22 @@ static void leds_set(void) } /** @brief set the time on the LEDs - * @details this will have an animation where time is incremented until it reaches the provided time * @param[in] time time to set */ static void clock_set_time(uint32_t time) +{ + led_off(); + clock_show_time(time); // set time + leds_set(); // set the colors of all LEDs + ws2812b_transmit(); // transmit set color + led_on(); +} + +/** @brief incrementally set the time on the LEDs + * @details this will have an animation where time is incremented until it reaches the provided time + * @param[in] time time to set + */ +static void clock_animate_time(uint32_t time) { static uint32_t display_time = 0; // the time to display while (display_time