boards/frdm-k22f/include/periph_conf.h

CLOCK_CORECLOCK
1
(60000000ul)
CLOCK_BUSCLOCK
1
(CLOCK_CORECLOCK / 2)
const clock_config_t clock_config
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
= {
    
    .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(1) |
               SIM_CLKDIV1_OUTDIV3(2) | SIM_CLKDIV1_OUTDIV4(2),
    .rtc_clc = 0, 
    .osc32ksel = SIM_SOPT1_OSC32KSEL(2),
    .clock_flags =
        KINETIS_CLOCK_OSC0_EN |
        KINETIS_CLOCK_RTCOSC_EN |
        KINETIS_CLOCK_USE_FAST_IRC |
        0,
    .default_mode = KINETIS_MCG_MODE_FEE,
    
    .erc_range = KINETIS_MCG_ERC_RANGE_HIGH,
    .osc_clc = 0, 
    .oscsel = MCG_C7_OSCSEL(0), 
    .fcrdiv = MCG_SC_FCRDIV(0), 
    .fll_frdiv = MCG_C1_FRDIV(0b011), 
    .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464, 
    .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1920, 
    .pll_prdiv = MCG_C5_PRDIV0(0b00011), 
    .pll_vdiv  = MCG_C6_VDIV0(0b00110), 
}
PIT_NUMOF
1
(2U)
PIT_CONFIG
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{             \
    {                            \
        .prescaler_ch = 0,       \
        .count_ch = 1,           \
    },                           \
    {                            \
        .prescaler_ch = 2,       \
        .count_ch = 3,           \
    },                           \
}
LPTMR_NUMOF
1
(1U)
LPTMR_CONFIG
1
2
3
4
5
6
7
8
{          \
    {                           \
        .dev = LPTMR0,          \
        .irqn = LPTMR0_IRQn,    \
        .src = 2,               \
        .base_freq = 32768u,    \
    },                          \
}
TIMER_NUMOF
1
((PIT_NUMOF) + (LPTMR_NUMOF))
PIT_BASECLOCK
1
(CLOCK_BUSCLOCK)
PIT_ISR_0
1
isr_pit1
PIT_ISR_1
1
isr_pit3
LPTMR_ISR_0
1
isr_lptmr0
UART_0_ISR
1
(isr_uart1_rx_tx)
UART_NUMOF
1
(sizeof(uart_config) / sizeof(uart_config[0]))
const uart_conf_t uart_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
= {
    {
        .dev    = UART1,
        .freq   = CLOCK_CORECLOCK,
        .pin_rx = GPIO_PIN(PORT_E,  1),
        .pin_tx = GPIO_PIN(PORT_E,  0),
        .pcr_rx = PORT_PCR_MUX(3),
        .pcr_tx = PORT_PCR_MUX(3),
        .irqn   = UART1_RX_TX_IRQn,
        .scgc_addr = &SIM->SCGC4,
        .scgc_bit = SIM_SCGC4_UART1_SHIFT,
        .mode   = UART_MODE_8N1,
        .type   = KINETIS_UART,
    },
}
ADC_NUMOF
1
(sizeof(adc_config) / sizeof(adc_config[0]))
ADC_REF_SETTING
1
0
const adc_conf_t adc_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
= {
    
    [ 0] = { .dev = ADC0, .pin = GPIO_UNDEF          , .chan =  0, .avg = ADC_AVG_MAX }, 
    [ 1] = { .dev = ADC0, .pin = GPIO_UNDEF          , .chan = 19, .avg = ADC_AVG_MAX }, 
    [ 2] = { .dev = ADC1, .pin = GPIO_UNDEF          , .chan =  0, .avg = ADC_AVG_MAX }, 
    [ 3] = { .dev = ADC1, .pin = GPIO_UNDEF          , .chan = 19, .avg = ADC_AVG_MAX }, 
    [ 4] = { .dev = ADC0, .pin = GPIO_PIN(PORT_B,  0), .chan =  8, .avg = ADC_AVG_MAX }, 
    [ 5] = { .dev = ADC0, .pin = GPIO_PIN(PORT_B,  1), .chan =  9, .avg = ADC_AVG_MAX }, 
    [ 6] = { .dev = ADC0, .pin = GPIO_PIN(PORT_C,  1), .chan = 15, .avg = ADC_AVG_MAX }, 
    [ 7] = { .dev = ADC0, .pin = GPIO_PIN(PORT_C,  2), .chan =  4, .avg = ADC_AVG_MAX }, 
    
    
    [ 8] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 26, .avg = ADC_AVG_NONE },
    
    
    [ 9] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 27, .avg = ADC_AVG_MAX },
}
PWM_NUMOF
1
(sizeof(pwm_config) / sizeof(pwm_config[0]))
const pwm_conf_t pwm_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
= {
    {
        .ftm        = FTM0,
        .chan       = {
            { .pin = GPIO_PIN(PORT_A, 1), .af = 3, .ftm_chan = 6 },
            { .pin = GPIO_PIN(PORT_A, 2), .af = 3, .ftm_chan = 7 },
            { .pin = GPIO_PIN(PORT_D, 5), .af = 4, .ftm_chan = 5 },
        },
        .chan_numof = 3,
        .ftm_num    = 0
    }
}
SPI_NUMOF
1
(sizeof(spi_config) / sizeof(spi_config[0]))
const uint32_t spi_clk_config()
const spi_conf_t spi_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
= {
    {
        .dev      = SPI0,
        .pin_miso = GPIO_PIN(PORT_D, 3),
        .pin_mosi = GPIO_PIN(PORT_D, 2),
        .pin_clk  = GPIO_PIN(PORT_D, 1),
        .pin_cs   = {
            GPIO_PIN(PORT_C, 4),
            GPIO_PIN(PORT_D, 4),
            GPIO_UNDEF,
            GPIO_UNDEF,
            GPIO_UNDEF
        },
        .pcr      = GPIO_AF_2,
        .simmask  = SIM_SCGC6_SPI0_MASK
    }
}
I2C_NUMOF
1
(sizeof(i2c_config) / sizeof(i2c_config[0]))
I2C_0_ISR
1
(isr_i2c0)
I2C_1_ISR
1
(isr_i2c1)
const i2c_conf_t i2c_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
= {
    {
        .i2c = I2C0,
        .scl_pin = GPIO_PIN(PORT_B, 2),
        .sda_pin = GPIO_PIN(PORT_B, 3),
        .freq = CLOCK_BUSCLOCK,
        .speed = I2C_SPEED_FAST,
        .irqn = I2C0_IRQn,
        .scl_pcr = (PORT_PCR_MUX(2) | PORT_PCR_ODE_MASK),
        .sda_pcr = (PORT_PCR_MUX(2) | PORT_PCR_ODE_MASK),
    },
}