23 #include "periph_cpu.h"
34 static const clock_config_t clock_config = {
43 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) |
44 SIM_CLKDIV1_OUTDIV3(2) | SIM_CLKDIV1_OUTDIV4(2),
46 .osc32ksel = SIM_SOPT1_OSC32KSEL(2),
49 KINETIS_CLOCK_RTCOSC_EN |
50 KINETIS_CLOCK_USE_FAST_IRC |
52 .default_mode = KINETIS_MCG_MODE_PEE,
54 .erc_range = KINETIS_MCG_ERC_RANGE_VERY_HIGH,
56 .oscsel = MCG_C7_OSCSEL(0),
57 .fcrdiv = MCG_SC_FCRDIV(0),
58 .fll_frdiv = MCG_C1_FRDIV(0b111),
59 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
60 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1920,
61 .pll_prdiv = MCG_C5_PRDIV0(0b10011),
62 .pll_vdiv = MCG_C6_VDIV0(0b00000),
64 #define CLOCK_CORECLOCK (60000000ul)
65 #define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 1)
72 #define PIT_NUMOF (2U)
73 #define PIT_CONFIG { \
83 #define LPTMR_NUMOF (1U)
84 #define LPTMR_CONFIG { \
87 .irqn = LPTMR0_IRQn, \
89 .base_freq = 32768u, \
92 #define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
94 #define PIT_BASECLOCK (CLOCK_BUSCLOCK)
95 #define PIT_ISR_0 isr_pit1
96 #define PIT_ISR_1 isr_pit3
97 #define LPTMR_ISR_0 isr_lptmr0
110 .pcr_rx = PORT_PCR_MUX(3),
111 .pcr_tx = PORT_PCR_MUX(3),
112 .irqn = UART0_RX_TX_IRQn,
113 .scgc_addr = &SIM->SCGC4,
114 .scgc_bit = SIM_SCGC4_UART0_SHIFT,
120 #define UART_0_ISR (isr_uart0_rx_tx)
122 #define UART_NUMOF ARRAY_SIZE(uart_config)
158 #define ADC_NUMOF ARRAY_SIZE(adc_config)
165 #define ADC_REF_SETTING 0
186 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
202 SPI_CTAR_PBR(2) | SPI_CTAR_BR(6) |
203 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(5) |
204 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(5) |
205 SPI_CTAR_PDT(2) | SPI_CTAR_DT(5)
208 SPI_CTAR_PBR(2) | SPI_CTAR_BR(4) |
209 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(3) |
210 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(3) |
211 SPI_CTAR_PDT(2) | SPI_CTAR_DT(3)
214 SPI_CTAR_PBR(2) | SPI_CTAR_BR(2) |
215 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(4) |
216 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(4) |
217 SPI_CTAR_PDT(0) | SPI_CTAR_DT(4)
220 SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) |
221 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(0) |
222 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(0) |
223 SPI_CTAR_PDT(1) | SPI_CTAR_DT(0)
226 SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |
227 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(1) |
228 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(1) |
229 SPI_CTAR_PDT(0) | SPI_CTAR_DT(1)
247 .simmask = SIM_SCGC6_SPI0_MASK
251 #define SPI_NUMOF ARRAY_SIZE(spi_config)
264 .freq = CLOCK_BUSCLOCK,
267 .scl_pcr = (PORT_PCR_MUX(5) | PORT_PCR_ODE_MASK),
268 .sda_pcr = (PORT_PCR_MUX(5) | PORT_PCR_ODE_MASK),
271 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
272 #define I2C_0_ISR (isr_i2c0)
273 #define I2C_1_ISR (isr_i2c1)