diff --git a/main.c b/main.c index 24b8165..e101458 100644 --- a/main.c +++ b/main.c @@ -39,6 +39,7 @@ #include // external interrupt utilities #include // timer utilities #include // ADC utilities +#include // real time clock utilities /* own libraries */ #include "global.h" // board definitions @@ -368,6 +369,11 @@ int main(void) nvic_enable_irq(BUTTON_IRQ); // enable interrupt #endif + // setup RTC + rtc_auto_awake(RCC_LSE, 32768/TICKS_PER_SECOND-1); // ensure RTC is on, uses the 32.678 kHz LSE, and the prescale is set to our tick speed, else update backup registers accordingly + rtc_interrupt_enable(RTC_SEC); // enable RTC interrupt on "seconds" + nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt + // generate gamma correction table (with fixed gamma value) for (uint16_t i=0; i