application: use LSE for oscillator (and remove other board ifdef
This commit is contained in:
parent
4229353d93
commit
aaeed65c18
@ -37,13 +37,12 @@
|
||||
#include <libopencm3/stm32/dbgmcu.h> // debug utilities
|
||||
#include <libopencm3/stm32/desig.h> // design utilities
|
||||
#include <libopencm3/stm32/flash.h> // flash utilities
|
||||
#include <libopencm3/stm32/f1/bkp.h> // backup domain utilities
|
||||
|
||||
/* own libraries */
|
||||
#include "global.h" // board definitions
|
||||
#include "print.h" // printing utilities
|
||||
#if !defined(STLINKV2)
|
||||
#include "uart.h" // USART utilities
|
||||
#endif
|
||||
#include "usb_cdcacm.h" // USB CDC ACM utilities
|
||||
#include "terminal.h" // handle the terminal interface
|
||||
#include "menu.h" // menu utilities
|
||||
@ -54,16 +53,12 @@
|
||||
/** set to 0 if the RTC is reset when the board is powered on, only indicates the uptime
|
||||
* set to 1 if VBAT can keep the RTC running when the board is unpowered, indicating the date and time
|
||||
*/
|
||||
#if defined(CORE_BOARD)
|
||||
#define RTC_DATE_TIME 1
|
||||
#else
|
||||
#define RTC_DATE_TIME 0
|
||||
#endif
|
||||
|
||||
/** number of RTC ticks per second
|
||||
* @note use integer divider of oscillator to keep second precision
|
||||
*/
|
||||
#define RTC_TICKS_SECOND 4
|
||||
#define RTC_TICKS_SECOND 1
|
||||
|
||||
#if defined(RTC_DATE_TIME) && RTC_DATE_TIME
|
||||
/** the start time from which to RTC ticks count
|
||||
@ -609,12 +604,8 @@ void main(void)
|
||||
|
||||
// setup RTC
|
||||
puts("setup internal RTC: ");
|
||||
#if defined(BLUE_PILL) || defined(STLINKV2) || defined(BLASTER) // for boards without a Low Speed External oscillator
|
||||
// note: the blue pill LSE oscillator is affected when toggling the onboard LED, thus prefer the HSE
|
||||
rtc_auto_awake(RCC_HSE, 8000000 / 128 / RTC_TICKS_SECOND - 1); // use High Speed External oscillator (8 MHz / 128) as RTC clock (VBAT can't be used to keep the RTC running)
|
||||
#else // for boards with an precise Low Speed External oscillator
|
||||
// note: the blue pill LSE oscillator is affected when toggling the onboard LED -> DON'T USE THE ONBOARD LED since we want to use the LSE
|
||||
rtc_auto_awake(RCC_LSE, 32768 / RTC_TICKS_SECOND - 1); // ensure internal 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)
|
||||
#endif
|
||||
rtc_interrupt_enable(RTC_SEC); // enable RTC interrupt on "seconds"
|
||||
nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt
|
||||
time_start = rtc_get_counter_val(); // get start time from internal RTC
|
||||
|
Loading…
Reference in New Issue
Block a user