ChibiOS/HAL  7.1.5
hal_st.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 /**
18  * @file hal_st.h
19  * @brief ST Driver macros and structures.
20  * @details This header is designed to be include-able without having to
21  * include other files from the HAL.
22  *
23  * @addtogroup ST
24  * @{
25  */
26 
27 #ifndef HAL_ST_H
28 #define HAL_ST_H
29 
30 #include "hal_st_lld.h"
31 
32 /*===========================================================================*/
33 /* Driver constants. */
34 /*===========================================================================*/
35 
36 /*===========================================================================*/
37 /* Driver pre-compile time settings. */
38 /*===========================================================================*/
39 
40 /*===========================================================================*/
41 /* Derived constants and error checks. */
42 /*===========================================================================*/
43 
44 /* Compatibility with old LLDS.*/
45 #if !defined(ST_LLD_NUM_ALARMS)
46 #define ST_LLD_NUM_ALARMS 1
47 #endif
48 
49 /*===========================================================================*/
50 /* Driver data structures and types. */
51 /*===========================================================================*/
52 
53 typedef void (*st_callback_t)(unsigned alarm);
54 
55 /*===========================================================================*/
56 /* Driver macros. */
57 /*===========================================================================*/
58 
59 /*===========================================================================*/
60 /* External declarations. */
61 /*===========================================================================*/
62 
63 #if (ST_LLD_NUM_ALARMS > 1) && !defined(__DOXYGEN__)
64 extern st_callback_t st_callbacks[ST_LLD_NUM_ALARMS - 1];
65 #endif
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70  void stInit(void);
71  void stStartAlarm(systime_t abstime);
72  void stStopAlarm(void);
73  void stSetAlarm(systime_t abstime);
74  systime_t stGetAlarm(void);
75  systime_t stGetCounter(void);
76  bool stIsAlarmActive(void);
77 #if ST_LLD_NUM_ALARMS > 1
78  bool stIsAlarmActiveN(unsigned alarm);
79  void stStartAlarmN(unsigned alarm, systime_t abstime, st_callback_t cb);
80  void stStopAlarmN(unsigned alarm);
81  void stSetAlarmN(unsigned alarm, systime_t abstime);
82  systime_t stGetAlarmN(unsigned alarm);
83 #endif
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* HAL_ST_H */
89 
90 /** @} */
stStopAlarmN
void stStopAlarmN(unsigned alarm)
Stops an additional alarm.
Definition: hal_st.c:213
stGetCounter
systime_t stGetCounter(void)
Returns the time counter value.
Definition: hal_st.c:147
stSetAlarm
void stSetAlarm(systime_t abstime)
Sets the alarm zero time.
Definition: hal_st.c:115
stGetAlarmN
systime_t stGetAlarmN(unsigned alarm)
Returns an additional alarm current time.
Definition: hal_st.c:249
stInit
void stInit(void)
ST Driver initialization.
Definition: hal_st.c:64
stIsAlarmActiveN
bool stIsAlarmActiveN(unsigned alarm)
Determines if the specified alarm is active.
Definition: hal_st.c:177
hal_st_lld.h
PLATFORM ST subsystem low level driver header.
systime_t
uint32_t systime_t
Type of system time counter.
Definition: osal.h:164
stStartAlarmN
void stStartAlarmN(unsigned alarm, systime_t abstime, st_callback_t cb)
Starts an additional alarm.
Definition: hal_st.c:195
stSetAlarmN
void stSetAlarmN(unsigned alarm, systime_t abstime)
Sets an additional alarm time.
Definition: hal_st.c:231
stIsAlarmActive
bool stIsAlarmActive(void)
Determines if the alarm zero is active.
Definition: hal_st.c:161
stStopAlarm
void stStopAlarm(void)
Stops the alarm zero interrupt.
Definition: hal_st.c:101
stGetAlarm
systime_t stGetAlarm(void)
Returns the alarm zero current time.
Definition: hal_st.c:131
stStartAlarm
void stStartAlarm(systime_t abstime)
Starts the alarm zero.
Definition: hal_st.c:87