LED driver implemented

This commit is contained in:
Mark Qvist 2019-01-12 16:30:26 +01:00
parent fa1d89d0e3
commit 6258e1e62e
7 changed files with 53 additions and 49 deletions

View file

@ -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