https://github.com/seff34/linux-timer-api-in-c
Library is a High-Level POSIX TIMER API.
https://github.com/seff34/linux-timer-api-in-c
c c-timer cpp embedded embedded-c embedded-linux embedded-systems linux-timer timer timer-application timer-interrupt timers
Last synced: 7 months ago
JSON representation
Library is a High-Level POSIX TIMER API.
- Host: GitHub
- URL: https://github.com/seff34/linux-timer-api-in-c
- Owner: seff34
- Created: 2022-08-22T13:05:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-25T17:39:19.000Z (about 3 years ago)
- Last Synced: 2025-01-19T18:52:03.638Z (9 months ago)
- Topics: c, c-timer, cpp, embedded, embedded-c, embedded-linux, embedded-systems, linux-timer, timer, timer-application, timer-interrupt, timers
- Language: C
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Embedded Linux Timer API
Library is a High-Level POSIX TIMER API.
## API Functions
#### Define Timer Signal
```c
#define TIMER_SIGNAL_1 SIGRTMIN + 1
```#### Allocate Memory
```c
timerValues_t *timer1 = (timerValues_t *)malloc(sizeof(timerValues_t));
```
#### Timer Initalize
```c
timerInit(timer1,TIMER_SIGNAL_1,timerCallback_1);
```| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Name` | `timer_t` | Timer Name |
| `Signal` | `uint16_t` | Timer Signal|
| `Callback ` | `void *` | Timer Callback Functions |#### Timer Start
```c
timerStart(timer1, 0 , 1000 ); -> 1second Periodic Timer
timerStart(timer1, 1000, 1000 ); -> 1second Periodic Timer
timerStart(timer1, 3000, 0 ); -> 3second One Shot Timer
```| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Name` | `timer_t` | Timer Name |
| `Time_Ms` | `uint16_t` | One Shot Timer Value (ms)|
| `Time_Ms ` | `uint16_t ` | Periodic Timer Value (ms) |#### Timer Stop
```c
timerStop(timer1);
```| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Name` | `timer_t` | Timer Name |#### Timer Deinit
```c
timerDeinit(timer1);
```| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `Name` | `timer_t` | Timer Name |#### Timer Callback Function
```c
void timerCallback_1(int signal)
{
//(void)signal;
printf("Timer Interrupt %d ------------\n",signal);
}
```
## Download CodeClone Project
```bash
git clone https://github.com/seff34/Linux-Timer-API
```
## References:https://man7.org/linux/
https://demirten.gitbooks.io/linux-sistem-programlama/content/timers/posix.html