RP RTC add alarm macros

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14152 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
cinsights 2021-04-09 06:59:25 +00:00
parent dfb451f438
commit 730ac499bb
2 changed files with 15 additions and 3 deletions

View File

@ -66,6 +66,7 @@ static void rtc_disable_alarm(RTCDriver *rtcp) {
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
/**
* @brief RTC alarm interrupt handler.
@ -77,7 +78,7 @@ OSAL_IRQ_HANDLER(RP_RTC_IRQ_HANDLER) {
OSAL_IRQ_PROLOGUE();
if (RTCD1.callback != NULL) {
RTCD1.callback(&RTCD1, 1);
RTCD1.callback(&RTCD1, RTC_EVENT_ALARM);
}
OSAL_IRQ_EPILOGUE();
@ -308,6 +309,7 @@ void rtc_lld_get_alarm(RTCDriver *rtcp,
}
#endif /* RTC_ALARMS > 0 */
#if RTC_SUPPORTS_CALLBACKS == TRUE
/**
* @brief Enables or disables RTC callbacks.
* @details This function enables or disables callbacks. Use a @p NULL pointer
@ -323,6 +325,7 @@ void rtc_lld_set_callback(RTCDriver *rtcp, rtccb_t callback) {
rtcp->callback = callback;
}
#endif /* RTC_SUPPORTS_CALLBACKS == TRUE */
#endif /* HAL_USE_RTC */

View File

@ -36,9 +36,9 @@
* @{
*/
/**
* @brief Callback support int the driver.
* @brief Callback support in the driver.
*/
#define RTC_SUPPORTS_CALLBACKS FALSE
#define RTC_SUPPORTS_CALLBACKS TRUE
/**
* @brief Number of alarms available.
@ -86,6 +86,13 @@
/* Driver data structures and types. */
/*===========================================================================*/
/**
* @brief Type of an RTC event.
*/
typedef enum {
RTC_EVENT_ALARM = 0, /** Alarm. */
} rtcevent_t;
/**
* @brief Type of a generic RTC callback.
*/
@ -122,6 +129,8 @@ typedef struct {
#define RTC_ENABLE_DT_ALARM(n) (1U << n)
#define RTC_TEST_DT_ALARM(a, n) ((a & (1U << n)) != 0)
#define RTC_DISABLE_ALL_DT_ALARMS 0U
#define RTC_ENABLE_ALL_DT_ALARMS ((rtcdtmask_t)-1)
/*===========================================================================*/
/* External declarations. */