AVR XMEGA 32-bit Real Time Counter driver.
Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | RTC32_struct2 |
struct | rtc_data_struct |
Driver private struct. More... | |
Macros | |
#define | RTC32 (*(RTC32_t2 *)0x0420) |
#define | RTC32_CLOCK VBAT_XOSCSEL_bm |
#define | RTC32_COMPARE_INT_LEVEL CONFIG_RTC32_COMPARE_INT_LEVEL |
Typedefs | |
typedef struct RTC32_struct2 | RTC32_t2 |
Functions | |
ISR (RTC32_COMP_vect) | |
Compare interrupt used for alarm. More... | |
bool | rtc_alarm_has_triggered (void) |
Check if pending alarm has triggered. More... | |
static uint32_t | rtc_get_counter (void) |
Get counter. More... | |
uint32_t | rtc_get_time (void) |
Get current time. More... | |
void | rtc_init (void) |
Initialize the 32kHz oscillator and RTC32. More... | |
static __always_inline bool | rtc_is_busy (void) |
Check if RTC32 is busy synchronizing. More... | |
void | rtc_set_alarm (uint32_t time) |
Set alarm time. More... | |
void | rtc_set_callback (rtc_callback_t callback) |
Set callback to call on alarm. More... | |
void | rtc_set_time (uint32_t time) |
Set current time. More... | |
enum vbat_status_code | rtc_vbat_system_check (bool first_time_startup) |
Checks battery backup system status. More... | |
static void | vbat_init (void) |
Initialize VBAT and start 32kHz oscillator. More... | |
Variables | |
struct rtc_data_struct | rtc_data |
Driver private data. More... | |
#define RTC32 (*(RTC32_t2 *)0x0420) |
Workaround for missing CNT, PER and COMP in WinAVR header files
Referenced by ISR(), rtc_alarm_has_triggered(), rtc_get_counter(), rtc_init(), rtc_is_busy(), rtc_set_alarm(), and rtc_set_time().
#define RTC32_CLOCK VBAT_XOSCSEL_bm |
Referenced by vbat_init().
#define RTC32_COMPARE_INT_LEVEL CONFIG_RTC32_COMPARE_INT_LEVEL |
Referenced by rtc_alarm_has_triggered(), and rtc_set_alarm().
typedef struct RTC32_struct2 RTC32_t2 |
Workaround for missing CNT, PER and COMP in WinAVR header files
ISR | ( | RTC32_COMP_vect | ) |
Compare interrupt used for alarm.
Disables the RTC32 interrupts, then calls the alarm callback function if one has been set.
References rtc_data_struct::callback, RTC32, rtc_data, and rtc_get_time().
|
inlinestatic |
|
static |
Check if RTC32 is busy synchronizing.
true | Is busy |
false | Is ready |
References RTC32.
Referenced by rtc_init(), and rtc_set_time().
|
static |
Initialize VBAT and start 32kHz oscillator.
Enables access to the VBAT system, performs a reset, enables the failure detection, and starts the oscillator.
The default clock rate to the RTC32 is 1Hz but this can be changed to 1024Hz by the user in the module configuration by defining CONFIG_RTC32_CLOCK_1024HZ.
References ccp_write_io(), delay_us, and RTC32_CLOCK.
Referenced by rtc_init().
struct rtc_data_struct rtc_data |
Driver private data.
Referenced by ISR(), rtc_get_time(), rtc_set_alarm(), rtc_set_callback(), and rtc_set_time().