Skip to content

Commit cf48f41

Browse files
committed
lpc1756 added posibility to override the init detection
1 parent 9eb0b7c commit cf48f41

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

targets/core/nxp/lpc175x/rtc.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ namespace klib::core::lpc175x::io {
1919
* @param cal_value
2020
* @param cal_direction
2121
*/
22+
template <bool Override = false>
2223
static void init(const uint32_t cal_value = 0, const bool cal_direction = 1) {
2324
// enable the power for the rtc
2425
target::io::power_control::enable<Rtc>();
2526

26-
// check if the rtc is already on (and not in reset)
27-
if (Rtc::port->CCR & 0x1 && !(Rtc::port->CCR & (0x1 << 1))) {
28-
// rtc already on. No need for more configuration
29-
return;
27+
// check if we should always override any configuration
28+
if constexpr (!Override) {
29+
// check if the rtc is already on (and not in reset)
30+
if (Rtc::port->CCR & 0x1 && !(Rtc::port->CCR & (0x1 << 1))) {
31+
// rtc already on. No need for more configuration
32+
return;
33+
}
3034
}
3135

3236
// disable the oscillator fail detect interrupt

0 commit comments

Comments
 (0)