diff --git a/main.c b/main.c index 4e08911..4a0706f 100644 --- a/main.c +++ b/main.c @@ -371,7 +371,7 @@ int main(void) #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_auto_awake(RCC_LSE, 32768/ticks_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 @@ -455,6 +455,11 @@ int main(void) printf("current time: %02lu:%02lu:%02lu\n", rtc_get_counter_val()/ticks_hour, (rtc_get_counter_val()%ticks_hour)/ticks_minute, (rtc_get_counter_val()%ticks_minute)/ticks_second); // display time clock_animate_time(rtc_get_counter_val()); // set time with animation + + printf("ticks/s: %lu (%d)\n",ticks_second, TICKS_PER_SECOND); + printf("RTC prescale set: %lu\n",32768/ticks_second-1); + //printf("RTC prescale get: %lu\n",rtc_get_prescale_div_val()); + printf("input commands\n"); bool action = false; // if an action has been performed don't go to sleep button_flag = false; // reset button flag @@ -502,6 +507,7 @@ int main(void) adc_start_conversion_regular(ADC1); // start measuring ambient luminosity } if ((rtc_get_counter_val()%ticks_second)==0) { // one second passed + //printf("ticks: %lu\n", rtc_get_counter_val()); led_toggle(); // LED activity to show we are not stuck } if ((rtc_get_counter_val()%ticks_minute)==0) { // one minute passed