aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/st.h11
-rw-r--r--os/hal/platforms/STM32/TIMv1/st_lld.h14
2 files changed, 25 insertions, 0 deletions
diff --git a/os/hal/include/st.h b/os/hal/include/st.h
index 05d382d93..b2cb00543 100644
--- a/os/hal/include/st.h
+++ b/os/hal/include/st.h
@@ -111,6 +111,17 @@
* @api
*/
#define stGetAlarm() st_lld_get_alarm()
+
+/**
+ * @brief Determines if the alarm is active.
+ *
+ * @return The alarm status.
+ * @retval false if the alarm is not active.
+ * @retval true is the alarm is active
+ *
+ * @api
+ */
+#define stIsAlarmActive() st_lld_is_alarm_active()
/** @} */
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/TIMv1/st_lld.h b/os/hal/platforms/STM32/TIMv1/st_lld.h
index 882472cb2..fb067f202 100644
--- a/os/hal/platforms/STM32/TIMv1/st_lld.h
+++ b/os/hal/platforms/STM32/TIMv1/st_lld.h
@@ -128,6 +128,20 @@ static inline systime_t st_lld_get_alarm(void) {
return (systime_t)STM32_TIM2->CCR[0];
}
+/**
+ * @brief Determines if the alarm is active.
+ *
+ * @return The alarm status.
+ * @retval false if the alarm is not active.
+ * @retval true is the alarm is active
+ *
+ * @notapi
+ */
+static inline bool st_lld_is_alarm_active(void) {
+
+ return (bool)((STM32_TIM2->DIER & STM32_TIM_DIER_CC1IE) != 0);
+}
+
#endif /* _ST_LLD_H_ */
/** @} */