1
0
Fork 0

Consolidate timer_elapsed implementations (#24830)

This commit is contained in:
Joel Challis 2025-01-19 17:07:11 +00:00 committed by GitHub
parent a62f9a2ffd
commit cedd49c59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 44 deletions

View file

@ -125,34 +125,6 @@ inline uint32_t timer_read32(void) {
return t;
}
/** \brief timer elapsed
*
* FIXME: needs doc
*/
inline uint16_t timer_elapsed(uint16_t last) {
uint32_t t;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
t = timer_count;
}
return TIMER_DIFF_16((t & 0xFFFF), last);
}
/** \brief timer elapsed32
*
* FIXME: needs doc
*/
inline uint32_t timer_elapsed32(uint32_t last) {
uint32_t t;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
t = timer_count;
}
return TIMER_DIFF_32(t, last);
}
// excecuted once per 1ms.(excess for just timer count?)
#ifndef __AVR_ATmega32A__
# define TIMER_INTERRUPT_VECTOR TIMER0_COMPA_vect

View file

@ -118,11 +118,3 @@ uint32_t timer_read32(void) {
return (uint32_t)TIME_I2MS(ticks) + ms_offset_copy;
}
uint16_t timer_elapsed(uint16_t last) {
return TIMER_DIFF_16(timer_read(), last);
}
uint32_t timer_elapsed32(uint32_t last) {
return TIMER_DIFF_32(timer_read32(), last);
}

View file

@ -60,14 +60,6 @@ uint32_t timer_read32(void) {
return current_time;
}
uint16_t timer_elapsed(uint16_t last) {
return TIMER_DIFF_16(timer_read(), last);
}
uint32_t timer_elapsed32(uint32_t last) {
return TIMER_DIFF_32(timer_read32(), last);
}
void set_time(uint32_t t) {
current_time = t;
access_counter = 0;

View file

@ -6,3 +6,11 @@
// Generate out-of-line copies for inline functions defined in timer.h.
extern inline fast_timer_t timer_read_fast(void);
extern inline fast_timer_t timer_elapsed_fast(fast_timer_t last);
uint16_t timer_elapsed(uint16_t last) {
return TIMER_DIFF_16(timer_read(), last);
}
uint32_t timer_elapsed32(uint32_t last) {
return TIMER_DIFF_32(timer_read32(), last);
}

View file

@ -16,6 +16,7 @@
DEBOUNCE_COMMON_DEFS := -DMATRIX_ROWS=4 -DMATRIX_COLS=10 -DDEBOUNCE=5
DEBOUNCE_COMMON_SRC := $(QUANTUM_PATH)/debounce/tests/debounce_test_common.cpp \
$(PLATFORM_PATH)/timer.c \
$(PLATFORM_PATH)/$(PLATFORM_KEY)/timer.c
debounce_none_DEFS := $(DEBOUNCE_COMMON_DEFS)

View file

@ -4,4 +4,5 @@ os_detection_DEFS += -DOS_DETECTION_DEBOUNCE=50
os_detection_SRC := \
$(QUANTUM_PATH)/os_detection/tests/os_detection.cpp \
$(QUANTUM_PATH)/os_detection.c \
$(PLATFORM_PATH)/timer.c \
$(PLATFORM_PATH)/$(PLATFORM_KEY)/timer.c

View file

@ -8,4 +8,5 @@ sequencer_SRC := \
$(QUANTUM_PATH)/sequencer/tests/midi_mock.c \
$(QUANTUM_PATH)/sequencer/tests/sequencer_tests.cpp \
$(QUANTUM_PATH)/sequencer/sequencer.c \
$(PLATFORM_PATH)/timer.c \
$(PLATFORM_PATH)/$(PLATFORM_KEY)/timer.c