forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "cmsis.h" | ||
#include "timer.h" | ||
|
||
/* Mill second tick count */ | ||
volatile uint32_t timer_count = 0; | ||
|
||
/* Timer interrupt handler */ | ||
void SysTick_Handler(void) { | ||
timer_count++; | ||
} | ||
|
||
void timer_init(void) | ||
{ | ||
SysTick_Config(SystemCoreClock / 1000); /* 1ms tick */ | ||
} | ||
|
||
void timer_clear(void) | ||
{ | ||
timer_count = 0; | ||
} | ||
|
||
uint16_t timer_read(void) | ||
{ | ||
return (uint16_t)(timer_count & 0xFFFF); | ||
} | ||
|
||
uint32_t timer_read32(void) | ||
{ | ||
return timer_count; | ||
} | ||
|
||
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
COMMON_DIR = common | ||
OBJECTS += \ | ||
# $(COMMON_DIR)/host.o \ | ||
# $(COMMON_DIR)/keyboard.o \ | ||
# $(COMMON_DIR)/action.o \ | ||
# $(COMMON_DIR)/action_tapping.o \ | ||
# $(COMMON_DIR)/action_macro.o \ | ||
# $(COMMON_DIR)/action_layer.o \ | ||
# $(COMMON_DIR)/action_util.o \ | ||
# $(COMMON_DIR)/keymap.o \ | ||
# $(COMMON_DIR)/timer.o \ | ||
$(COMMON_DIR)/print.o \ | ||
# $(COMMON_DIR)/bootloader.o \ | ||
# $(COMMON_DIR)/suspend.o \ | ||
$(COMMON_DIR)/xprintf.o \ | ||
$(COMMON_DIR)/util.o | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/timer.o \ | ||
|
||
INCLUDE_PATHS += \ | ||
-I$(TMK_DIR)/$(COMMON_DIR) | ||
|
||
|
||
|
||
|
||
# $(OBJDIR)/$(COMMON_DIR)/host.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/keyboard.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/action.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/action_tapping.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/action_macro.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/action_layer.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/action_util.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/keymap.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/bootloader.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/suspend.o \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters