Driver API for RTC (plib_rtc_16count.h) More...
Data Structures | |
| struct | RTC_16COUNT_OBJECT |
| RTC 16-bit counter object structure. More... | |
Typedefs | |
| typedef uint32_t | RTC_16COUNT_INT_MASK |
| RTC 16-bit counter interrupt mask type. | |
| typedef void(* | RTC_16COUNT_CALLBACK) (RTC_16COUNT_INT_MASK int_cause) |
| RTC callback function type for 16-bit counter mode. | |
Functions | |
| void | RTC_16COUNT_Initialize (void) |
| Initializes the RTC in 16-bit counter mode. This sets up the interrupt handler for RTC 16-bit counter mode. | |
| void | RTC_16COUNT_SoftwareReset (void) |
| Performs a software reset of the RTC module. | |
| void | RTC_16COUNT_SetMode (void) |
| Configures the RTC to operate in 16-bit counter mode. | |
| void | RTC_16COUNT_Enable (void) |
| Enables the RTC 16-bit counter. | |
| void | RTC_16COUNT_Disable (void) |
| Disables the RTC 16-bit counter. | |
| void | RTC_16COUNT_SetPrescaler (uint16_t prescaler) |
| Configures the RTC prescaler. | |
| void | RTC_16COUNT_CorrectFrequency (int8_t correction) |
| Applies frequency correction to the RTC. | |
| void | RTC_16COUNT_EnableCountSync (void) |
| Enables synchronization of the RTC counter. | |
| void | RTC_16COUNT_DisableCountSync (void) |
| Disables synchronization of the RTC counter. | |
| void | RTC_16COUNT_SetCounter (uint16_t count) |
| Sets the current value of the RTC counter. | |
| void | RTC_16COUNT_SetCompare0 (uint16_t compare_value) |
| Sets the compare value for Compare 0. | |
| void | RTC_16COUNT_SetCompare1 (uint16_t compare_value) |
| Sets the compare value for Compare 1. | |
| void | RTC_16COUNT_SetPeriod (uint16_t period_value) |
| Sets the period value for the RTC counter. | |
| uint32_t | RTC_16COUNT_GetCounter (void) |
| Gets the current value of the RTC counter. | |
| uint16_t | RTC_16COUNT_GetPeriod (void) |
| Gets the value of the RTC period register. | |
| void | RTC_16COUNT_EnableInterrupt (RTC_16COUNT_INT_MASK interrupt_mask) |
| Enables a specific RTC interrupt mask. | |
| void | RTC_16COUNT_DisableInterrupt (RTC_16COUNT_INT_MASK interrupt_mask) |
| Disables a specific RTC interrupt mask. | |
| void | RTC_16COUNT_SetCallbackHandler (RTC_16COUNT_CALLBACK callback) |
| Registers a callback function for RTC interrupts. | |
| void | RTC_SetInterruptHandler (void(*callback)(void)) |
| Registers the RTC interrupt callback function. The callback function can be called from main.c for direct callback registration. | |
Variables | |
| RTC_16COUNT_CALLBACK | RTC_16COUNT_OBJECT::timer16bit_callback |
| Callback function pointer for RTC 16-bit counter interrupts. | |
| RTC_16COUNT_INT_MASK | RTC_16COUNT_OBJECT::timer16int_cause |
| Interrupt cause mask for the last RTC interrupt. | |
Driver API for RTC (plib_rtc_16count.h)
The following example demonstrates typical usage of the RTC peripheral:
| typedef void(* RTC_16COUNT_CALLBACK) (RTC_16COUNT_INT_MASK int_cause) |
RTC callback function type for 16-bit counter mode.
| typedef uint32_t RTC_16COUNT_INT_MASK |
RTC 16-bit counter interrupt mask type.
| void RTC_16COUNT_CorrectFrequency | ( | int8_t | correction | ) |
Applies frequency correction to the RTC.
| correction | Signed correction value. |
| void RTC_16COUNT_Disable | ( | void | ) |
Disables the RTC 16-bit counter.
| void RTC_16COUNT_DisableCountSync | ( | void | ) |
Disables synchronization of the RTC counter.
| void RTC_16COUNT_DisableInterrupt | ( | RTC_16COUNT_INT_MASK | interrupt_mask | ) |
Disables a specific RTC interrupt mask.
| interrupt_mask | Interrupt mask to disable. |
| void RTC_16COUNT_Enable | ( | void | ) |
Enables the RTC 16-bit counter.
| void RTC_16COUNT_EnableCountSync | ( | void | ) |
Enables synchronization of the RTC counter.
| void RTC_16COUNT_EnableInterrupt | ( | RTC_16COUNT_INT_MASK | interrupt_mask | ) |
Enables a specific RTC interrupt mask.
| interrupt_mask | Interrupt mask to enable. |
| uint32_t RTC_16COUNT_GetCounter | ( | void | ) |
Gets the current value of the RTC counter.
| uint16_t RTC_16COUNT_GetPeriod | ( | void | ) |
Gets the value of the RTC period register.
| void RTC_16COUNT_Initialize | ( | void | ) |
Initializes the RTC in 16-bit counter mode. This sets up the interrupt handler for RTC 16-bit counter mode.
| void RTC_16COUNT_SetCallbackHandler | ( | RTC_16COUNT_CALLBACK | callback | ) |
Registers a callback function for RTC interrupts.
| callback | Pointer to the callback function. |
| void RTC_16COUNT_SetCompare0 | ( | uint16_t | compare_value | ) |
Sets the compare value for Compare 0.
| compare_value | Compare 0 match value. |
| void RTC_16COUNT_SetCompare1 | ( | uint16_t | compare_value | ) |
Sets the compare value for Compare 1.
| compare_value | Compare 1 match value. |
| void RTC_16COUNT_SetCounter | ( | uint16_t | count | ) |
Sets the current value of the RTC counter.
| count | Counter value to set. |
| void RTC_16COUNT_SetMode | ( | void | ) |
Configures the RTC to operate in 16-bit counter mode.
| void RTC_16COUNT_SetPeriod | ( | uint16_t | period_value | ) |
Sets the period value for the RTC counter.
| period_value | Period register value. |
| void RTC_16COUNT_SetPrescaler | ( | uint16_t | prescaler | ) |
Configures the RTC prescaler.
This function sets the prescaler field in the RTC CTRLA register. The input parameter is NOT the actual division factor (e.g., 1024), but the encoded value corresponding to the PRESCALER bit field
For example:
| prescaler | Encoded PRESCALER field value (not the division factor). |
| void RTC_16COUNT_SoftwareReset | ( | void | ) |
Performs a software reset of the RTC module.
| void RTC_SetInterruptHandler | ( | void(*)(void) | callback | ) |
Registers the RTC interrupt callback function. The callback function can be called from main.c for direct callback registration.
| [in] | callback | Pointer to user-defined RTC interrupt handler function. Pass NULL to unregister any existing callback. |
| RTC_16COUNT_CALLBACK RTC_16COUNT_OBJECT::timer16bit_callback |
Callback function pointer for RTC 16-bit counter interrupts.
| RTC_16COUNT_INT_MASK RTC_16COUNT_OBJECT::timer16int_cause |
Interrupt cause mask for the last RTC interrupt.