Skip to content

Commit 9f98d39

Browse files
author
Cruz Monrreal
authored
Merge pull request #8122 from thesupershan/master
LPC1768 us_ticker.c timer choice
2 parents 21b4eca + e5000ab commit 9f98d39

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

targets/TARGET_NXP/TARGET_LPC176X/us_ticker.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,19 @@ const ticker_info_t* us_ticker_get_info()
2828

2929
static bool us_ticker_inited = false;
3030

31+
#if MBED_CONF_TARGET_US_TICKER_TIMER == 0
32+
#define US_TICKER_TIMER ((LPC_TIM_TypeDef *)LPC_TIM0_BASE)
33+
#define US_TICKER_TIMER_IRQn TIMER0_IRQn
34+
#elif MBED_CONF_TARGET_US_TICKER_TIMER == 1
35+
#define US_TICKER_TIMER ((LPC_TIM_TypeDef *)LPC_TIM1_BASE)
36+
#define US_TICKER_TIMER_IRQn TIMER1_IRQn
37+
#elif MBED_CONF_TARGET_US_TICKER_TIMER == 2
38+
#define US_TICKER_TIMER ((LPC_TIM_TypeDef *)LPC_TIM2_BASE)
39+
#define US_TICKER_TIMER_IRQn TIMER2_IRQn
40+
#else
3141
#define US_TICKER_TIMER ((LPC_TIM_TypeDef *)LPC_TIM3_BASE)
3242
#define US_TICKER_TIMER_IRQn TIMER3_IRQn
43+
#endif
3344

3445
void us_ticker_init(void) {
3546
if (us_ticker_inited) {

targets/targets.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@
251251
"release_versions": ["2", "5"],
252252
"device_name": "LPC1768",
253253
"bootloader_supported": true,
254+
"config": {
255+
"us-ticker-timer": {
256+
"help": "Chooses which timer (0-3) to use for us_ticker.c",
257+
"value": 3
258+
}
259+
},
254260
"overrides": {
255261
"network-default-interface-type": "ETHERNET"
256262
}

0 commit comments

Comments
 (0)