From fa1d89d0e334496e0b22fa8b1b4d5947328780f6 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 12 Jan 2019 15:14:41 +0100 Subject: [PATCH] LED driver work --- hardware/AFSK.c | 4 ++-- protocol/KISS.c | 2 +- util/time.h | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hardware/AFSK.c b/hardware/AFSK.c index f8686e3..ca03f6d 100755 --- a/hardware/AFSK.c +++ b/hardware/AFSK.c @@ -6,11 +6,11 @@ // TODO: Remove testing vars //// #define SAMPLES_TO_CAPTURE 128 -ticks_t capturedsamples = 0; +uint32_t capturedsamples = 0; uint8_t samplebuf[SAMPLES_TO_CAPTURE]; ///////////////////////////////// -extern volatile ticks_t _clock; +extern volatile uint32_t _clock; extern unsigned long custom_preamble; extern unsigned long custom_tail; diff --git a/protocol/KISS.c b/protocol/KISS.c index 82b5a01..0d8ed56 100755 --- a/protocol/KISS.c +++ b/protocol/KISS.c @@ -24,7 +24,7 @@ size_t packet_lengths_buf[CONFIG_QUEUE_MAX_LENGTH+1]; AX25Ctx *ax25ctx; Afsk *channel; Serial *serial; -volatile ticks_t last_serial_read = 0; +volatile uint32_t last_serial_read = 0; size_t frame_len; bool IN_FRAME; bool ESCAPE; diff --git a/util/time.h b/util/time.h index 94a75b2..d84ef4c 100755 --- a/util/time.h +++ b/util/time.h @@ -6,13 +6,13 @@ #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 ticks_t timer_clock(void) { - ticks_t result; +static inline uint32_t timer_clock(void) { + uint32_t result; ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { result = _clock; @@ -22,7 +22,7 @@ static inline ticks_t timer_clock(void) { } -inline ticks_t ms_to_ticks(mtime_t ms) { +inline uint32_t ms_to_ticks(mtime_t ms) { return ms * DIV_ROUND(CLOCK_TICKS_PER_SEC, 1000); }