Skip to content

Commit c05a893

Browse files
committed
MCUXpresso: Update usticker driver
Move clock frequency to a target specific function Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent b582c54 commit c05a893

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC/us_ticker.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ const ticker_info_t* us_ticker_get_info()
2929

3030
static bool us_ticker_inited = false;
3131

32+
extern uint32_t us_ticker_get_clock();
33+
3234
/** Initialize the high frequency ticker
3335
*
3436
*/
3537
void us_ticker_init(void) {
3638
ctimer_config_t config;
3739

38-
uint32_t pclk = CLOCK_GetFreq(kCLOCK_BusClk);
40+
41+
uint32_t pclk = us_ticker_get_clock();
42+
3943
uint32_t prescale = pclk / 1000000; // default to 1MHz (1 us ticks)
4044

4145
/* Let the timer to count if re-init. */

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC54114/TARGET_LPCXpresso/mbed_overrides.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@ void rtc_setup_oscillator(void)
5151
SYSCON->RTCOSCCTRL |= SYSCON_RTCOSCCTRL_EN_MASK;
5252
}
5353

54+
uint32_t us_ticker_get_clock()
55+
{
56+
return CLOCK_GetFreq(kCLOCK_BusClk);;
57+
}
58+

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MCU_LPC546XX/TARGET_FF_LPC546XX/mbed_overrides.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ void rtc_setup_oscillator(void)
6666
SYSCON->RTCOSCCTRL |= SYSCON_RTCOSCCTRL_EN_MASK;
6767
}
6868

69+
uint32_t us_ticker_get_clock()
70+
{
71+
return CLOCK_GetFreq(kCLOCK_BusClk);;
72+
}
73+
6974
void ADC_ClockPower_Configuration(void)
7075
{
7176
/* SYSCON power. */

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MCU_LPC546XX/TARGET_LPCXpresso/mbed_overrides.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ void rtc_setup_oscillator(void)
8282
SYSCON->RTCOSCCTRL |= SYSCON_RTCOSCCTRL_EN_MASK;
8383
}
8484

85+
uint32_t us_ticker_get_clock()
86+
{
87+
return CLOCK_GetFreq(kCLOCK_BusClk);;
88+
}
89+
8590
// Provide ethernet devices with a semi-unique MAC address from the UUID
8691
void mbed_mac_address(char *mac)
8792
{

0 commit comments

Comments
 (0)