|
at24cm0x 1.0
at24cm0x driver library
|
Implements the SysTick utility functions. More...
#include "systick.h"
Functions | |
| void | systick_init (void) |
| Initializes the SysTick timer module. | |
| void | systick_reset (void) |
| Resets the SysTick timer value. | |
| void | systick_tick (void) |
| Increments the SysTick timer tick counter. | |
| unsigned int | systick_current (void) |
| Returns the current SysTick tick counter value. | |
| void | systick_timer_set (SYSTICK_Timer *timer, unsigned int delay_ticks) |
| Sets and starts a SysTick software timer. | |
| SYSTICK_Timer_Status | systick_timer_elapsed (SYSTICK_Timer *timer) |
| Checks whether a SysTick software timer has expired. | |
| unsigned int | systick_timer_remaining (SYSTICK_Timer *timer) |
| Returns the remaining time before a SysTick timer expires. | |
| void | systick_timer_wait (unsigned int ticks) |
| Blocks execution for a specified number of SysTick ticks. | |
| void | systick_timer_cancel (SYSTICK_Timer *timer) |
| Cancels a running SysTick software timer. | |
Variables | |
| volatile unsigned int | systick_tick_value |
Implements the SysTick utility functions.
This file provides the implementation of the SysTick utility functions declared in systick.h. It manages a software timer based on the SysTick peripheral, allowing for non-blocking delays and periodic tasks.
| unsigned int systick_current | ( | void | ) |
Returns the current SysTick tick counter value.
This function reads the current value of the internal SysTick tick counter (systick_tick_value) in an atomic operation to prevent race conditions during concurrent access from interrupts. The returned value represents the elapsed system ticks since the last reset or initialization of the SysTick module.

| void systick_init | ( | void | ) |
Initializes the SysTick timer module.
This function initializes the SysTick timer by resetting its internal state and preparing it for subsequent use. It calls systick_reset() to ensure the timer starts from a known default state.
Typically, this function should be called once during system initialization before any SysTick-based timing operations are performed.

| void systick_reset | ( | void | ) |
Resets the SysTick timer value.
This function clears the internal SysTick tick counter by setting systick_tick_value to zero. It ensures that the timer restarts counting from the beginning, which is useful during initialization or when restarting time measurements.

| void systick_tick | ( | void | ) |
Increments the SysTick timer tick counter.
This function increases the internal systick_tick_value by one. It should be called periodically—typically from the SysTick interrupt service routine—to maintain an accurate system tick counter used for software timing and scheduling operations.
| void systick_timer_cancel | ( | SYSTICK_Timer * | timer | ) |
Cancels a running SysTick software timer.
This function stops a SysTick timer by setting its status to SYSTICK_Timer_Expired, effectively marking it as completed regardless of its current tick count. Once canceled, the timer will be considered expired and will no longer count down or trigger expiration checks.
| [in,out] | timer | Pointer to the SysTick timer instance to cancel. |
| SYSTICK_Timer_Status systick_timer_elapsed | ( | SYSTICK_Timer * | timer | ) |
Checks whether a SysTick software timer has expired.
This function determines if the specified SYSTICK_Timer instance has reached its expiration tick value. If the current SysTick count has passed the timer's expire value, the timer status is updated to SYSTICK_Timer_Expired. Otherwise, the timer remains in the running state.
| [in,out] | timer | Pointer to the SysTick timer instance to check. |


| unsigned int systick_timer_remaining | ( | SYSTICK_Timer * | timer | ) |
Returns the remaining time before a SysTick timer expires.
This function calculates the number of SysTick ticks remaining until the specified SYSTICK_Timer instance reaches its expiration value. If the timer has already expired, its status is updated to SYSTICK_Timer_Expired, and the function returns zero.
| [in,out] | timer | Pointer to the SysTick timer instance to query. |

| void systick_timer_set | ( | SYSTICK_Timer * | timer, |
| unsigned int | delay_ticks ) |
Sets and starts a SysTick software timer.
This function initializes a given SYSTICK_Timer instance by setting its expiration tick value relative to the current SysTick count. The timer is configured to expire after the specified number of delay_ticks and marked as running.
| [in,out] | timer | Pointer to the SysTick timer instance to configure. |
| [in] | delay_ticks | Number of SysTick ticks after which the timer should expire. |


| void systick_timer_wait | ( | unsigned int | ticks | ) |
Blocks execution for a specified number of SysTick ticks.
This function creates a temporary SYSTICK_Timer instance and waits until it expires. The function blocks program execution by polling the timer status in a busy-wait loop, using a NOP instruction for each iteration to prevent compiler optimization and reduce power consumption on some architectures.
| [in] | ticks | The number of SysTick ticks to wait before returning. |

| volatile unsigned int systick_tick_value |