mbed library with additional peripherals for ST F401 board
Fork of mbed-src by
This mbed LIB has additional peripherals for ST F401 board
- UART2 : PA_3 rx, PA_2 tx
- UART3 : PC_7 rx, PC_6 tx
- I2C2 : PB_3 SDA, PB_10 SCL
- I2C3 : PB_4 SDA, PA_8 SCL
Diff: targets/hal/TARGET_Freescale/TARGET_KL25Z/us_ticker.c
- Revision:
- 74:847f030b50ee
- Parent:
- 72:248c61396e08
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/us_ticker.c Tue Jan 14 20:45:05 2014 +0000 +++ b/targets/hal/TARGET_Freescale/TARGET_KL25Z/us_ticker.c Tue Jan 14 22:15:04 2014 +0000 @@ -102,10 +102,22 @@ } } } - //No suitable external oscillator clock -> Use fast internal oscillator (4MHz) + //No suitable external oscillator clock -> Use fast internal oscillator (4MHz / divider) MCG->C1 |= MCG_C1_IRCLKEN_MASK; MCG->C2 |= MCG_C2_IRCS_MASK; - LPTMR0->PSR = LPTMR_PSR_PCS(0) | LPTMR_PSR_PRESCALE(1); + LPTMR0->PSR = LPTMR_PSR_PCS(0); + switch (MCG->SC & MCG_SC_FCRDIV_MASK) { + case MCG_SC_FCRDIV(0): //4MHz + LPTMR0->PSR |= LPTMR_PSR_PRESCALE(1); + break; + case MCG_SC_FCRDIV(1): //2MHz + LPTMR0->PSR |= LPTMR_PSR_PRESCALE(0); + break; + default: //1MHz or anything else, in which case we put it on 1MHz + MCG->SC &= ~MCG_SC_FCRDIV_MASK; + MCG->SC |= MCG_SC_FCRDIV(2); + LPTMR0->PSR |= LPTMR_PSR_PBYP_MASK; + } }