diff --git a/main.c b/main.c index 242e00f..06931f5 100644 --- a/main.c +++ b/main.c @@ -57,8 +57,8 @@ volatile bool photoresistor_flag = false; /**< flag set when ambient luminosity * @note I have to use type variables because defines would be stored in signed integers, leading to an overflow it later calculations * @{ */ -/** the number of ticks in one second (depend on the number of LED since it tries to have 255 tick per LED per second) */ -#define TICKS_PER_SECOND 256*WS2812B_LEDS/60 +/** the number of ticks in one second (a powe or 2 > 256*WS2812B_LEDS/60) */ +#define TICKS_PER_SECOND 256 /** number of ticks in one second */ const uint32_t ticks_second = TICKS_PER_SECOND; /** number of ticks in one minute */ @@ -371,7 +371,7 @@ int main(void) #endif // setup RTC - 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_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 (power off the micro-controller for the change to take effect) rtc_interrupt_enable(RTC_SEC); // enable RTC interrupt on "seconds" nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt @@ -502,7 +502,6 @@ 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