ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
Loading...
Searching...
No Matches
Functions
millisec_timer.c File Reference
#include "millisec_timer.h"
#include <time.h>
Include dependency graph for millisec_timer.c:

Go to the source code of this file.

Functions

void millisec_timer_set_rel (millisec_timer *timer, const millisec_timer_unit_t now, const millisec_timer_unit_t rel)
 Set timer to expire in the future.
 
bool millisec_timer_is_expired (millisec_timer *timer, const millisec_timer_unit_t now)
 Check if timer has expired & if so, disable it.
 
bool millisec_timer_is_expired_repeat (millisec_timer *timer, const millisec_timer_unit_t now)
 Check if timer has expired & if so, re-enable for the same interval.
 
void millisec_timer_systick_setup (uint32_t ahb_frequency)
 Setup the systick timer.
 

Function Documentation

◆ millisec_timer_is_expired()

bool millisec_timer_is_expired ( millisec_timer * timer,
const millisec_timer_unit_t now )

Check if timer has expired & if so, disable it.

If timer is enabled and it's expired, return true and disable the timer. If not enabled or the time hasn't expired, return false.

Definition at line 16 of file millisec_timer.c.

◆ millisec_timer_is_expired_repeat()

bool millisec_timer_is_expired_repeat ( millisec_timer * timer,
const millisec_timer_unit_t now )

Check if timer has expired & if so, re-enable for the same interval.

If timer is enabled and it's set time has expired: 1) set the new expiration time to be the old expire time + (old expire time

  • old set time) 2) set the new set time to be the old expire time 3) return true. If not enabled or the time hasn't expired, return false.

Definition at line 30 of file millisec_timer.c.

◆ millisec_timer_set_rel()

void millisec_timer_set_rel ( millisec_timer * timer,
const millisec_timer_unit_t now,
const millisec_timer_unit_t rel )

Set timer to expire in the future.

Sets and enables timer to expire rel ms in the future.

This sets the set_time to now and the expire_time to set_time + rel

Definition at line 8 of file millisec_timer.c.

◆ millisec_timer_systick_setup()

void millisec_timer_systick_setup ( uint32_t ahb_frequency)

Setup the systick timer.

Configures the systick timer to raise the interrupt every millisecond.

Definition at line 50 of file millisec_timer.c.