19#include "periph_cpu.h" 
   30static const clock_config_t clock_config = {
 
   39    .clkdiv1            = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1),
 
   40    .rtc_clc            = RTC_CR_SC16P_MASK | RTC_CR_SC4P_MASK | RTC_CR_SC2P_MASK,
 
   45    .osc32ksel          = SIM_SOPT1_OSC32KSEL(0),
 
   49        KINETIS_CLOCK_OSC0_EN | 
 
   50        KINETIS_CLOCK_RTCOSC_EN |
 
   51        KINETIS_CLOCK_USE_FAST_IRC |
 
   52        KINETIS_CLOCK_MCGIRCLK_EN | 
 
   53        KINETIS_CLOCK_MCGIRCLK_STOP_EN |
 
   58    .default_mode       = KINETIS_MCG_MODE_FEI,
 
   61    .erc_range          = KINETIS_MCG_ERC_RANGE_VERY_HIGH,
 
   64    .oscsel             = MCG_C7_OSCSEL(0), 
 
   65    .fcrdiv             = MCG_SC_FCRDIV(0), 
 
   67    .fll_frdiv          = MCG_C1_FRDIV(0b101), 
 
   68    .fll_factor_fei     = KINETIS_MCG_FLL_FACTOR_1464, 
 
   69    .fll_factor_fee     = KINETIS_MCG_FLL_FACTOR_1280, 
 
   72#define CLOCK_RADIOXTAL              (32000000ul) 
   74#define CLOCK_CORECLOCK              (48000000ul) 
   75#define CLOCK_BUSCLOCK               (CLOCK_CORECLOCK / 2) 
   76#define CLOCK_MCGFLLCLK              (CLOCK_CORECLOCK) 
   77#define CLOCK_OSCERCLK               (CLOCK_RADIOXTAL) 
   78#define CLOCK_MCGIRCLK               (4000000ul) 
   92#define LPTMR_NUMOF             (1U) 
   93#define LPTMR_CONFIG {               \ 
   96            .base_freq = 32768u,     \ 
   98            .irqn = LPTMR0_IRQn,     \ 
  101#define TIMER_NUMOF             ((PIT_NUMOF) + (LPTMR_NUMOF)) 
  102#define PIT_BASECLOCK           (CLOCK_BUSCLOCK) 
  103#define LPTMR_ISR_0             isr_lptmr0 
  111#define LPUART_0_SRC                1 
  114#if (LPUART_0_SRC == 3) 
  116#define LPUART_0_CLOCK                  CLOCK_MCGIRCLK 
  117#define UART_CLOCK_PM_BLOCKER           KINETIS_PM_LLS 
  118#define UART_MAX_UNCLOCKED_BAUDRATE     19200ul 
  119#elif (LPUART_0_SRC == 2) 
  120#define LPUART_0_CLOCK                  CLOCK_OSCERCLK 
  121#elif (LPUART_0_SRC == 1) 
  123#define LPUART_0_CLOCK                  CLOCK_MCGFLLCLK 
  124#define UART_CLOCK_PM_BLOCKER           KINETIS_PM_STOP 
  125#define UART_MAX_UNCLOCKED_BAUDRATE     57600ul 
  131        .freq   = LPUART_0_CLOCK,
 
  134        .pcr_rx = PORT_PCR_MUX(4) | GPIO_IN_PU,
 
  135        .pcr_tx = PORT_PCR_MUX(4),
 
  136        .irqn   = LPUART0_IRQn,
 
  137        .scgc_addr = &SIM->SCGC5,
 
  138        .scgc_bit = SIM_SCGC5_LPUART0_SHIFT,
 
  141#ifdef MODULE_PERIPH_LLWU  
  142        .llwu_rx = LLWU_WAKEUP_PIN_PTC6,
 
  146#define UART_NUMOF          ARRAY_SIZE(uart_config) 
  147#define LPUART_0_ISR        isr_lpuart0 
  178#define ADC_NUMOF           ARRAY_SIZE(adc_config) 
  185#define ADC_REF_SETTING     1 
  187#define ADC_REF_VOLTAGE     (3.3f) 
  189#define ADC_REF_VOLTAGE     (1.2f) 
  192#define ADC_TEMPERATURE_CHANNEL     (4) 
  203        .scgc_addr = &SIM->SCGC6,
 
  204        .scgc_bit  = SIM_SCGC6_DAC0_SHIFT,
 
  208#define DAC_NUMOF           ARRAY_SIZE(dac_config) 
  215#define HAVE_PWM_MODE_T 
  217    PWM_LEFT   = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK),  
 
 
  225#define PWM_CHAN_MAX        (4U) 
  261#define PWM_NUMOF           ARRAY_SIZE(pwm_config) 
  276        SPI_CTAR_PBR(2) | SPI_CTAR_BR(5) |          
 
  277        SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(4) |
 
  278        SPI_CTAR_PASC(2) | SPI_CTAR_ASC(4) |
 
  279        SPI_CTAR_PDT(2) | SPI_CTAR_DT(4)
 
  282        SPI_CTAR_PBR(2) | SPI_CTAR_BR(3) |          
 
  283        SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(2) |
 
  284        SPI_CTAR_PASC(2) | SPI_CTAR_ASC(2) |
 
  285        SPI_CTAR_PDT(2) | SPI_CTAR_DT(2)
 
  288        SPI_CTAR_PBR(0) | SPI_CTAR_BR(3) |          
 
  289        SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(3) |
 
  290        SPI_CTAR_PASC(0) | SPI_CTAR_ASC(3) |
 
  291        SPI_CTAR_PDT(0) | SPI_CTAR_DT(3)
 
  294        SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |          
 
  295        SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(1) |
 
  296        SPI_CTAR_PASC(0) | SPI_CTAR_ASC(1) |
 
  297        SPI_CTAR_PDT(0) | SPI_CTAR_DT(1)
 
  300        SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |          
 
  301        SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(0) |
 
  302        SPI_CTAR_PASC(0) | SPI_CTAR_ASC(0) |
 
  303        SPI_CTAR_PDT(0) | SPI_CTAR_DT(0)
 
  320        .pcr      = (gpio_pcr_t)(GPIO_AF_2 | GPIO_IN_PU),
 
  321        .simmask  = SIM_SCGC6_SPI0_MASK
 
  325#define SPI_NUMOF           ARRAY_SIZE(spi_config) 
  340        .scl_pcr = (PORT_PCR_MUX(3)),
 
  341        .sda_pcr = (PORT_PCR_MUX(3)),
 
  344#define I2C_NUMOF           ARRAY_SIZE(i2c_config) 
  345#define I2C_0_ISR           (isr_i2c1) 
  352#define KINETIS_TRNG                TRNG 
#define CLOCK_CORECLOCK
Clock configuration.
 
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
 
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
 
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
 
@ PWM_CENTER
center aligned
 
#define PWM_CHAN_MAX
PWM configuration structure.
 
static const spi_clk_conf_t spi_clk_config[]
Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz)
 
#define SPI_CS_UNDEF
Define value for unused CS line.
 
#define ADC_AVG_NONE
Disable hardware averaging.
 
@ KINETIS_LPUART
Kinetis Low-power UART (LPUART) module type.
 
@ UART_MODE_8N1
8 data bits, no parity, 1 stop bit
 
#define ADC_AVG_MAX
Maximum hardware averaging (32 samples)
 
ADC device configuration.
 
DAC line configuration data.
 
I2C configuration structure.
 
PWM device configuration.
 
uint8_t ftm_chan
the actual FTM channel used
 
gpio_t pin
GPIO pin used, set to GPIO_UNDEF.
 
gpio_af_t af
alternate function used
 
uint8_t tpm_num
FTM number used.
 
SPI device configuration.
 
UART device configuration.