mirror of
https://github.com/markqvist/OpenModem.git
synced 2025-08-09 23:23:06 -04:00
LED driver implemented
This commit is contained in:
parent
fa1d89d0e3
commit
6258e1e62e
7 changed files with 53 additions and 49 deletions
16
util/time.h
16
util/time.h
|
@ -6,13 +6,12 @@
|
|||
|
||||
#define DIV_ROUND(dividend, divisor) (((dividend) + (divisor) / 2) / (divisor))
|
||||
|
||||
//typedef int32_t ticks_t;
|
||||
//typedef int32_t mtime_t;
|
||||
typedef int32_t ticks_t;
|
||||
typedef int32_t mtime_t;
|
||||
volatile ticks_t _clock;
|
||||
|
||||
volatile uint32_t _clock;
|
||||
|
||||
static inline uint32_t timer_clock(void) {
|
||||
uint32_t result;
|
||||
static inline ticks_t timer_clock(void) {
|
||||
ticks_t result;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
result = _clock;
|
||||
|
@ -22,7 +21,7 @@ static inline uint32_t timer_clock(void) {
|
|||
}
|
||||
|
||||
|
||||
inline uint32_t ms_to_ticks(mtime_t ms) {
|
||||
inline ticks_t ms_to_ticks(mtime_t ms) {
|
||||
return ms * DIV_ROUND(CLOCK_TICKS_PER_SEC, 1000);
|
||||
}
|
||||
|
||||
|
@ -38,5 +37,4 @@ static inline void delay_ms(unsigned long ms) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue