33
44// clang-format off
55
6- /* Check if a timer is active. */
7- int _is_timer_active (timer_t * timer , bool * active ) {
8- /* Get the active indication. */
9- UINT is_active ;
10- int status = tx_timer_info_get (& timer -> TX_TIMER_ , (CHAR * * )TX_NULL , & is_active , (ULONG * )TX_NULL , (ULONG * )TX_NULL , (TX_TIMER * * )TX_NULL );
11- if (status != TX_SUCCESS ) {
12- PRINTLN_ERROR ("Failed to call tx_timer_info_get (Status: %d/%s, Timer: %s)." , status , tx_status_toString (status ), timer -> name );
13- return U_ERROR ;
14- }
15-
16- /* Check the indication. */
17- if (is_active == TX_TRUE ) {
18- * active = true;
19- } else {
20- * active = false;
21- }
22-
23- return U_SUCCESS ;
24- }
25-
266/* Initializes a timer. */
277int timer_init (timer_t * timer ) {
288 /* Set reschedule ticks setting. */
@@ -57,7 +37,7 @@ int timer_init(timer_t* timer) {
5737int timer_start (timer_t * timer ) {
5838 /* Get active status. */
5939 bool is_active = false;
60- int status = _is_timer_active (timer , & is_active );
40+ int status = timer_isActive (timer , & is_active );
6141 if (status != U_SUCCESS ) {
6242 PRINTLN_ERROR ("Failed to get the activation status of a timer (Timer: %s)." , timer -> name );
6343 return U_ERROR ;
@@ -153,4 +133,24 @@ int timer_getRemainingTicks(timer_t* timer, uint32_t* remaining) {
153133 return U_SUCCESS ;
154134}
155135
136+ /* Check if a timer is active. */
137+ int timer_isActive (timer_t * timer , bool * active ) {
138+ /* Get the active indication. */
139+ UINT is_active ;
140+ int status = tx_timer_info_get (& timer -> TX_TIMER_ , (CHAR * * )TX_NULL , & is_active , (ULONG * )TX_NULL , (ULONG * )TX_NULL , (TX_TIMER * * )TX_NULL );
141+ if (status != TX_SUCCESS ) {
142+ PRINTLN_ERROR ("Failed to call tx_timer_info_get (Status: %d/%s, Timer: %s)." , status , tx_status_toString (status ), timer -> name );
143+ return U_ERROR ;
144+ }
145+
146+ /* Check the indication. */
147+ if (is_active == TX_TRUE ) {
148+ * active = true;
149+ } else {
150+ * active = false;
151+ }
152+
153+ return U_SUCCESS ;
154+ }
155+
156156// clang-format on
0 commit comments