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.
◆ rtt_disable_interrupt()
void rtt_disable_interrupt |
( |
Rtt * |
p_rtt, |
|
|
uint32_t |
ul_sources |
|
) |
| |
Disable RTT interrupts.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
ul_sources | Interrupts to be disabled. |
Definition at line 175 of file rtt.c.
◆ rtt_enable_interrupt()
void rtt_enable_interrupt |
( |
Rtt * |
p_rtt, |
|
|
uint32_t |
ul_sources |
|
) |
| |
Enable RTT interrupts.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
ul_sources | Interrupts to be enabled. |
Definition at line 157 of file rtt.c.
◆ rtt_get_status()
uint32_t rtt_get_status |
( |
Rtt * |
p_rtt | ) |
|
Get the status register value of the given RTT.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
- Returns
- The Real-time Timer status.
Definition at line 212 of file rtt.c.
◆ rtt_init()
uint32_t rtt_init |
( |
Rtt * |
p_rtt, |
|
|
uint16_t |
us_prescaler |
|
) |
| |
Initialize the given RTT.
- Note
- This function restarts the real-time timer. If w_prescaler is equal to zero, the prescaler period is equal to 2^16 * SCLK period. If not, the prescaler period is equal to us_prescaler * SCLK period.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
us_prescaler | Prescaler value for the RTT. |
- Returns
- 0 if successful.
Definition at line 78 of file rtt.c.
◆ rtt_read_timer_value()
uint32_t rtt_read_timer_value |
( |
Rtt * |
p_rtt | ) |
|
Read the current value of the RTT timer value.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
- Returns
- The current Real-time Timer value.
Definition at line 194 of file rtt.c.
◆ rtt_write_alarm_time()
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.
- Parameters
-
p_rtt | Pointer to an RTT instance. |
ul_alarm_time | Alarm time,Alarm time = ALMV + 1. |
- Return values
-
Alarm time = ALMV + 1,If the incoming parameter is 0, the ALMV is set to 0xFFFFFFFF.
Definition at line 227 of file rtt.c.