22 #include "periph_cpu.h"
33 static const clock_config_t clock_config = {
42 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(1) |
43 SIM_CLKDIV1_OUTDIV3(2) | SIM_CLKDIV1_OUTDIV4(2),
45 .osc32ksel = SIM_SOPT1_OSC32KSEL(2),
47 KINETIS_CLOCK_OSC0_EN |
48 KINETIS_CLOCK_RTCOSC_EN |
49 KINETIS_CLOCK_USE_FAST_IRC |
51 .default_mode = KINETIS_MCG_MODE_FEE,
53 .erc_range = KINETIS_MCG_ERC_RANGE_HIGH,
55 .oscsel = MCG_C7_OSCSEL(0),
56 .fcrdiv = MCG_SC_FCRDIV(0),
57 .fll_frdiv = MCG_C1_FRDIV(0b011),
58 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
59 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1920,
60 .pll_prdiv = MCG_C5_PRDIV0(0b00011),
61 .pll_vdiv = MCG_C6_VDIV0(0b00110),
63 #define CLOCK_CORECLOCK (60000000ul)
64 #define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 2)
71 #define PIT_NUMOF (2U)
72 #define PIT_CONFIG { \
82 #define LPTMR_NUMOF (1U)
83 #define LPTMR_CONFIG { \
86 .irqn = LPTMR0_IRQn, \
88 .base_freq = 32768u, \
91 #define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
93 #define PIT_BASECLOCK (CLOCK_BUSCLOCK)
94 #define PIT_ISR_0 isr_pit1
95 #define PIT_ISR_1 isr_pit3
96 #define LPTMR_ISR_0 isr_lptmr0
109 .pcr_rx = PORT_PCR_MUX(3),
110 .pcr_tx = PORT_PCR_MUX(3),
111 .irqn = UART1_RX_TX_IRQn,
112 .scgc_addr = &SIM->SCGC4,
113 .scgc_bit = SIM_SCGC4_UART1_SHIFT,
122 .pcr_rx = PORT_PCR_MUX(3),
123 .pcr_tx = PORT_PCR_MUX(3),
124 .irqn = UART0_RX_TX_IRQn,
125 .scgc_addr = &SIM->SCGC4,
126 .scgc_bit = SIM_SCGC4_UART0_SHIFT,
132 #define UART_0_ISR (isr_uart1_rx_tx)
133 #define UART_1_ISR (isr_uart0_rx_tx)
135 #define UART_NUMOF ARRAY_SIZE(uart_config)
162 #define ADC_NUMOF ARRAY_SIZE(adc_config)
169 #define ADC_REF_SETTING 0
189 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
205 SPI_CTAR_PBR(0) | SPI_CTAR_BR(8) |
206 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(8) |
207 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(8) |
208 SPI_CTAR_PDT(0) | SPI_CTAR_DT(8)
211 SPI_CTAR_PBR(0) | SPI_CTAR_BR(6) |
212 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(6) |
213 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(6) |
214 SPI_CTAR_PDT(0) | SPI_CTAR_DT(6)
217 SPI_CTAR_PBR(1) | SPI_CTAR_BR(4) |
218 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(3) |
219 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(3) |
220 SPI_CTAR_PDT(1) | SPI_CTAR_DT(3)
223 SPI_CTAR_PBR(2) | SPI_CTAR_BR(0) |
224 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(0) |
225 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(0) |
226 SPI_CTAR_PDT(2) | SPI_CTAR_DT(0)
229 SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) |
230 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(0) |
231 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(0) |
232 SPI_CTAR_PDT(1) | SPI_CTAR_DT(0)
250 .simmask = SIM_SCGC6_SPI0_MASK
254 #define SPI_NUMOF ARRAY_SIZE(spi_config)
267 .freq = CLOCK_BUSCLOCK,
270 .scl_pcr = (PORT_PCR_MUX(2) | PORT_PCR_ODE_MASK),
271 .sda_pcr = (PORT_PCR_MUX(2) | PORT_PCR_ODE_MASK),
274 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
275 #define I2C_0_ISR (isr_i2c0)
276 #define I2C_1_ISR (isr_i2c1)