Skip to content

Commit e5000ab

Browse files
thesupershanAleshandre Diaz
authored andcommitted
Merge pull request #1 from thesupershan/lpc1768-us-ticker
choose which lpc1768 timer to use for us_ticker.c
2 parents d6ccf46 + 190803a commit e5000ab

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
@@ -247,6 +247,12 @@
247247
"release_versions": ["2", "5"],
248248
"device_name": "LPC1768",
249249
"bootloader_supported": true,
250+
"config": {
251+
"us-ticker-timer": {
252+
"help": "Chooses which timer (0-3) to use for us_ticker.c",
253+
"value": 3
254+
}
255+
},
250256
"overrides": {
251257
"network-default-interface-type": "ETHERNET"
252258
}

0 commit comments

Comments
 (0)