The Real-time Timer is built around a 32-bit counter used to count roll-over events of the programmable 16-bit prescaler, which enables counting elapsed seconds from a 32 kHz slow clock source.
This is a driver for configuration and use of the RTT peripheral.
Functions | |
void | rtt_disable (Rtt *p_rtt) |
Disable RTT. More... | |
void | rtt_disable_interrupt (Rtt *p_rtt, uint32_t ul_sources) |
Disable RTT interrupts. More... | |
void | rtt_enable (Rtt *p_rtt) |
Enable RTT. More... | |
void | rtt_enable_interrupt (Rtt *p_rtt, uint32_t ul_sources) |
Enable RTT interrupts. More... | |
uint32_t | rtt_get_status (Rtt *p_rtt) |
Get the status register value of the given RTT. More... | |
uint32_t | rtt_init (Rtt *p_rtt, uint16_t us_prescaler) |
Initialize the given RTT. More... | |
uint32_t | rtt_read_timer_value (Rtt *p_rtt) |
Read the current value of the RTT timer value. More... | |
void | rtt_sel_source (Rtt *p_rtt, bool is_rtc_sel) |
Select RTT counter source. More... | |
uint32_t | rtt_write_alarm_time (Rtt *p_rtt, uint32_t ul_alarm_time) |
Configure the RTT to generate an alarm at the given time. More... | |
Variables | |
static uint32_t | g_wobits_in_rtt_mr = 0 |
void rtt_disable | ( | Rtt * | p_rtt | ) |
void rtt_disable_interrupt | ( | Rtt * | p_rtt, |
uint32_t | ul_sources | ||
) |
Disable RTT interrupts.
p_rtt | Pointer to an RTT instance. |
ul_sources | Interrupts to be disabled. |
References g_wobits_in_rtt_mr.
Referenced by rtt_write_alarm_time().
void rtt_enable | ( | Rtt * | p_rtt | ) |
void rtt_enable_interrupt | ( | Rtt * | p_rtt, |
uint32_t | ul_sources | ||
) |
Enable RTT interrupts.
p_rtt | Pointer to an RTT instance. |
ul_sources | Interrupts to be enabled. |
References g_wobits_in_rtt_mr.
Referenced by configure_rtt(), and rtt_write_alarm_time().
uint32_t rtt_get_status | ( | Rtt * | p_rtt | ) |
Get the status register value of the given RTT.
p_rtt | Pointer to an RTT instance. |
Referenced by RTT_Handler().
uint32_t rtt_init | ( | Rtt * | p_rtt, |
uint16_t | us_prescaler | ||
) |
Initialize the given RTT.
p_rtt | Pointer to an RTT instance. |
us_prescaler | Prescaler value for the RTT. |
References g_wobits_in_rtt_mr.
Referenced by configure_rtt().
uint32_t rtt_read_timer_value | ( | Rtt * | p_rtt | ) |
Read the current value of the RTT timer value.
p_rtt | Pointer to an RTT instance. |
void rtt_sel_source | ( | Rtt * | p_rtt, |
bool | is_rtc_sel | ||
) |
Select RTT counter source.
p_rtt | Pointer to an RTT instance. |
is_rtc_sel | RTC 1Hz Clock Selection. |
References g_wobits_in_rtt_mr.
Referenced by configure_rtt().
uint32_t rtt_write_alarm_time | ( | Rtt * | p_rtt, |
uint32_t | ul_alarm_time | ||
) |
Configure the RTT to generate an alarm at the given time.
alarm happens when CRTV value equals ALMV+1, so RTT_AR should be alarmtime - 1. if you want to get alarm when rtt hit 0 , ALMV should be set to 0xFFFFFFFF.
p_rtt | Pointer to an RTT instance. |
ul_alarm_time | Alarm time,Alarm time = ALMV + 1. |
0 | Configuration is done. |
Alarm time = ALMV + 1,If the incoming parameter is 0, the ALMV is set to 0xFFFFFFFF.
References rtt_disable_interrupt(), and rtt_enable_interrupt().
|
static |
Referenced by rtt_disable(), rtt_disable_interrupt(), rtt_enable(), rtt_enable_interrupt(), rtt_init(), and rtt_sel_source().