Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2016 Freie Universität Berlin
3 * Copyright (C) 2017-2018 Eistec AB
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
10#pragma once
11
22
23#include <stdint.h>
24#include <stdbool.h>
25
26#include "cpu.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#ifdef PORT_PCR_MUX
33# define KINETIS_HAVE_PCR
34#endif
35
36#ifdef SIM_PINSEL_REG
37# define KINETIS_HAVE_PINSEL
38#endif
39
40#ifdef ADC_CFG1_MODE_MASK
41# define KINETIS_HAVE_ADC_K
42#endif
43
44#ifdef SPI_CTAR_CPHA_MASK
45# define KINETIS_HAVE_MK_SPI
46#endif
47
48#ifdef LPTMR_CSR_TEN_MASK
49# define KINETIS_HAVE_LPTMR
50#endif
51
56#define HAVE_GPIO_T
57typedef uint16_t gpio_t;
59
63#define GPIO_UNDEF (0xffff)
64
68#define GPIO_PIN(x, y) (((x + 1) << 12) | (x << 6) | y)
69
70#ifdef SIM_UIDH_UID_MASK
71/* Kinetis Cortex-M4 has a 128 bit SIM UID */
75#define CPUID_ADDR (&SIM->UIDH)
76
80#define CPUID_LEN (16U)
81#else /* defined(SIM_UIDH_UID_MASK) */
82/* Kinetis Cortex-M0+ has a 96 bit SIM UID */
86#define CPUID_ADDR (&SIM->UIDMH)
90#define CPUID_LEN (12U)
91#endif /* defined(SIM_UIDH_UID_MASK) */
92
102#define GPIO_MODE(pu, pe, od, out) (pu | (pe << 1) | (od << 5) | (out << 7))
103
110#define SPI_HWCS(x) (x)
111
115#define SPI_HWCS_NUMOF (5)
116
120#define SPI_CS_UNDEF (GPIO_UNDEF)
121
122#ifndef DOXYGEN
127#define HAVE_SPI_CS_T
128typedef uint32_t spi_cs_t;
130#endif
131
136#define PERIPH_SPI_NEEDS_TRANSFER_BYTE 1
137#define PERIPH_SPI_NEEDS_TRANSFER_REG 1
138#define PERIPH_SPI_NEEDS_TRANSFER_REGS 1
140
144#define PERIPH_TIMER_PROVIDES_SET
145
149#define TIMER_CHANNEL_NUMOF 1
150
155#define PM_NUM_MODES (4U)
156enum {
157 KINETIS_PM_LLS = 0,
158 KINETIS_PM_VLPS = 1,
159 KINETIS_PM_STOP = 2,
160 KINETIS_PM_WAIT = 3,
161};
162#if MODULE_PM_LAYERED
163#include "pm_layered.h"
167#define PM_BLOCK(x) pm_block(x)
171#define PM_UNBLOCK(x) pm_unblock(x)
172#else
173/* ignore these calls when not using pm_layered */
174#define PM_BLOCK(x)
175#define PM_UNBLOCK(x)
176#endif
178
179#ifndef DOXYGEN
184#define HAVE_GPIO_MODE_T
185typedef enum {
186 GPIO_IN = GPIO_MODE(0, 0, 0, 0),
187 GPIO_IN_PD = GPIO_MODE(0, 1, 0, 0),
188 GPIO_IN_PU = GPIO_MODE(1, 1, 0, 0),
189 GPIO_OUT = GPIO_MODE(0, 0, 0, 1),
190 GPIO_OD = GPIO_MODE(1, 0, 1, 1),
191 GPIO_OD_PU = GPIO_MODE(1, 1, 1, 1),
194#endif /* ndef DOXYGEN */
195
196#ifdef KINETIS_HAVE_PCR
202typedef enum {
203 GPIO_AF_ANALOG = PORT_PCR_MUX(0),
204 GPIO_AF_GPIO = PORT_PCR_MUX(1),
205 GPIO_AF_2 = PORT_PCR_MUX(2),
206 GPIO_AF_3 = PORT_PCR_MUX(3),
207 GPIO_AF_4 = PORT_PCR_MUX(4),
208 GPIO_AF_5 = PORT_PCR_MUX(5),
209 GPIO_AF_6 = PORT_PCR_MUX(6),
210 GPIO_AF_7 = PORT_PCR_MUX(7),
211#ifdef PORT_PCR_ODE_MASK
212 GPIO_PCR_OD = (PORT_PCR_ODE_MASK),
213#endif
214 GPIO_PCR_PD = (PORT_PCR_PE_MASK),
215 GPIO_PCR_PU = (PORT_PCR_PE_MASK | PORT_PCR_PS_MASK)
216} gpio_pcr_t;
217#endif /* KINETIS_HAVE_PCR */
218
219#ifndef DOXYGEN
224#ifdef KINETIS_HAVE_PCR
225#define HAVE_GPIO_FLANK_T
226typedef enum {
227 GPIO_RISING = PORT_PCR_IRQC(0x9),
228 GPIO_FALLING = PORT_PCR_IRQC(0xa),
229 GPIO_BOTH = PORT_PCR_IRQC(0xb),
231#endif /* KINETIS_HAVE_PCR */
233#endif /* ndef DOXYGEN */
234
240enum {
241 PORT_A = 0,
242 PORT_B = 1,
243 PORT_C = 2,
244 PORT_D = 3,
245 PORT_E = 4,
246 PORT_F = 5,
247 PORT_G = 6,
249};
250
251#ifndef DOXYGEN
256#define HAVE_ADC_RES_T
257#ifdef KINETIS_HAVE_ADC_K
258typedef enum {
259 ADC_RES_6BIT = (0xfe),
260 ADC_RES_8BIT = ADC_CFG1_MODE(0),
261 ADC_RES_10BIT = ADC_CFG1_MODE(2),
262 ADC_RES_12BIT = ADC_CFG1_MODE(1),
263 ADC_RES_14BIT = (0xff),
264 ADC_RES_16BIT = ADC_CFG1_MODE(3)
265} adc_res_t;
266#endif /* KINETIS_HAVE_ADC_K */
268
269#if defined(FTM_CnSC_MSB_MASK)
273#define PWM_CHAN_MAX (4U)
274
279#define HAVE_PWM_MODE_T
280typedef enum {
281 PWM_LEFT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK),
282 PWM_RIGHT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSA_MASK),
283 PWM_CENTER = (FTM_CnSC_MSB_MASK)
284} pwm_mode_t;
285#endif /* defined(FTM_CnSC_MSB_MASK) */
286#endif /* ndef DOXYGEN */
287
291typedef enum {
295#if defined(UART_C1_M_MASK) || DOXYGEN
296 /* LPUART and UART mode bits coincide, so the same setting for UART works on
297 * the LPUART as well */
298 UART_MODE_8E1 = (UART_C1_M_MASK | UART_C1_PE_MASK),
299#elif defined(LPUART_CTRL_M_MASK)
300 /* For CPUs which only have the LPUART */
301 UART_MODE_8E1 = (LPUART_CTRL_M_MASK | LPUART_CTRL_PE_MASK),
302#endif
304#if defined(UART_C1_M_MASK) || DOXYGEN
305 UART_MODE_8O1 = (UART_C1_M_MASK | UART_C1_PE_MASK | UART_C1_PT_MASK),
306#elif defined(LPUART_CTRL_M_MASK)
307 /* For CPUs which only have the LPUART */
308 UART_MODE_8O1 = (LPUART_CTRL_M_MASK | LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK),
309#endif
311
312#ifndef DOXYGEN
317
318#ifdef KINETIS_HAVE_MK_SPI
319#define HAVE_SPI_MODE_T
320typedef enum {
321#if defined(SPI_CTAR_CPHA_MASK)
322 SPI_MODE_0 = 0,
323 SPI_MODE_1 = (SPI_CTAR_CPHA_MASK),
324 SPI_MODE_2 = (SPI_CTAR_CPOL_MASK),
325 SPI_MODE_3 = (SPI_CTAR_CPOL_MASK | SPI_CTAR_CPHA_MASK)
326#elif defined(SPI_C1_CPHA_MASK)
327 SPI_MODE_0 = 0,
328 SPI_MODE_1 = (SPI_C1_CPHA_MASK),
329 SPI_MODE_2 = (SPI_C1_CPOL_MASK),
330 SPI_MODE_3 = (SPI_C1_CPOL_MASK | SPI_C1_CPHA_MASK)
331#endif
332} spi_mode_t;
334#endif /* KINETIS_HAVE_MK_SPI */
335#endif /* ndef DOXYGEN */
336
340typedef struct {
344 ADC_Type *dev;
350 gpio_t pin;
357 uint8_t chan;
363 uint8_t avg;
364} adc_conf_t;
365
369#define ADC_AVG_NONE (0)
373#define ADC_AVG_MAX (ADC_SC3_AVGE_MASK | ADC_SC3_AVGS(3))
374
375#if defined(DAC0_BASE) && (DAC0_BASE != This_symbol_has_been_deprecated)
379typedef struct {
380 DAC_Type *dev;
381 volatile uint32_t *scgc_addr;
382 uint8_t scgc_bit;
383} dac_conf_t;
384#endif
385
389typedef struct {
393 uint8_t count_ch;
394} pit_conf_t;
395
396#ifdef KINETIS_HAVE_LPTMR
400typedef struct {
402 LPTMR_Type *dev;
404 uint32_t base_freq;
406 uint8_t src;
408 uint8_t irqn;
409} lptmr_conf_t;
410#endif /* KINETIS_HAVE_LPTMR */
411
412#ifdef FTM_CnSC_MSB_MASK
416typedef struct {
417 FTM_Type* ftm;
418 struct {
419 gpio_t pin;
420 uint8_t af;
421 uint8_t ftm_chan;
422 } chan[PWM_CHAN_MAX];
423 uint8_t chan_numof;
424 uint8_t ftm_num;
425#ifdef KINETIS_HAVE_PINSEL
426 volatile uint32_t *pinsel;
427 uint32_t pinsel_mask;
428 uint32_t pinsel_val;
429#endif
430} pwm_conf_t;
431#endif
432
433#ifndef DOXYGEN
434#define HAVE_I2C_SPEED_T
435typedef enum {
436 I2C_SPEED_LOW = 10000ul,
437 I2C_SPEED_NORMAL = 100000ul,
438 I2C_SPEED_FAST = 400000ul,
439 I2C_SPEED_FAST_PLUS = 1000000ul,
440 /* High speed is not supported without external hardware hacks */
441 I2C_SPEED_HIGH = 3400000ul,
447#define PERIPH_I2C_NEED_READ_REG
448#define PERIPH_I2C_NEED_READ_REGS
449#define PERIPH_I2C_NEED_WRITE_REG
450#define PERIPH_I2C_NEED_WRITE_REGS
452#endif /* !defined(DOXYGEN) */
453
457typedef struct {
458 I2C_Type *i2c;
459 gpio_t scl_pin;
460 gpio_t sda_pin;
461 uint32_t freq;
464 uint32_t scl_pcr;
465 uint32_t sda_pcr;
466} i2c_conf_t;
467
471typedef struct {
472 SPI_Type *dev;
473 gpio_t pin_miso;
474 gpio_t pin_mosi;
475 gpio_t pin_clk;
477#ifdef KINETIS_HAVE_PCR
478 gpio_pcr_t pcr;
479#endif /* KINETIS_HAVE_PCR */
480#ifdef KINETIS_HAVE_PINSEL
481 volatile uint32_t *pinsel;
482 uint32_t pinsel_mask;
483 uint32_t pinsel_val;
484#endif
485 uint32_t simmask;
486} spi_conf_t;
487
491enum {
493#ifdef KINETIS_HAVE_LPTMR
494 TIMER_LPTMR,
495#endif /* KINETIS_HAVE_LPTMR */
496};
497
503#define TIMER_PIT_DEV(x) (TIMER_DEV(0 + (x)))
504#ifdef KINETIS_HAVE_LPTMR
506#define TIMER_LPTMR_DEV(x) (TIMER_DEV(PIT_NUMOF + (x)))
507#endif /* KINETIS_HAVE_LPTMR */
509
514#define RTT_DEV (TIMER_LPTMR_DEV(0))
515#define RTT_MAX_VALUE (0x0000ffff)
516#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
517#define RTT_MAX_FREQUENCY (32768U) /* in Hz */
518#define RTT_MIN_FREQUENCY (1U) /* in Hz */
519#ifndef RTT_FREQUENCY
520#define RTT_FREQUENCY RTT_MAX_FREQUENCY
521#endif
522#if IS_USED(MODULE_PERIPH_RTT)
523/* On kinetis periph_rtt is built on top on an LPTIMER so if used it
524 will conflict with xtimer, if a LPTIMER backend and RTT are needed
525 consider using ztimer */
526#define KINETIS_XTIMER_SOURCE_PIT 1
527#endif
528/* When setting a new compare value, the value must be at least 5 more
529 than the current sleep timer value. Otherwise, the timer compare
530 event may be lost. */
532
540
544typedef struct {
545 void *dev;
546 uint32_t freq;
547 gpio_t pin_rx;
548 gpio_t pin_tx;
549#ifdef KINETIS_HAVE_PCR
550 uint32_t pcr_rx;
551 uint32_t pcr_tx;
552#endif
553#ifdef KINETIS_HAVE_PINSEL
554 volatile uint32_t *pinsel;
555 uint32_t pinsel_mask;
556 uint32_t pinsel_val;
557#endif
559 volatile uint32_t *scgc_addr;
560 uint8_t scgc_bit;
564
565#if !defined(KINETIS_HAVE_PLL) && defined(MODULE_PERIPH_MCG) \
566 && defined(MCG_C6_PLLS_MASK) || DOXYGEN
570#define KINETIS_HAVE_PLL 1
571#else
572#define KINETIS_HAVE_PLL 0
573#endif
574
575#ifdef MODULE_PERIPH_MCG_LITE
579typedef enum kinetis_mcg_mode {
580 KINETIS_MCG_MODE_LIRC8M = 0,
581 KINETIS_MCG_MODE_HIRC = 1,
582 KINETIS_MCG_MODE_EXT = 2,
583 KINETIS_MCG_MODE_LIRC2M = 3,
584 KINETIS_MCG_MODE_NUMOF,
585} kinetis_mcg_mode_t;
586#endif /* MODULE_PERIPH_MCG_LITE */
587
588#ifdef MODULE_PERIPH_MCG
592typedef enum kinetis_mcg_mode {
593 KINETIS_MCG_MODE_FEI = 0,
594 KINETIS_MCG_MODE_FEE = 1,
595 KINETIS_MCG_MODE_FBI = 2,
596 KINETIS_MCG_MODE_FBE = 3,
597 KINETIS_MCG_MODE_BLPI = 4,
598 KINETIS_MCG_MODE_BLPE = 5,
599#if KINETIS_HAVE_PLL
600 KINETIS_MCG_MODE_PBE = 6,
601 KINETIS_MCG_MODE_PEE = 7,
602#endif
603 KINETIS_MCG_MODE_NUMOF,
604} kinetis_mcg_mode_t;
605
609typedef enum {
611 KINETIS_MCG_FLL_FACTOR_640 = (MCG_C4_DRST_DRS(0)),
613 KINETIS_MCG_FLL_FACTOR_732 = (MCG_C4_DRST_DRS(0) | MCG_C4_DMX32_MASK),
615 KINETIS_MCG_FLL_FACTOR_1280 = (MCG_C4_DRST_DRS(1)),
617 KINETIS_MCG_FLL_FACTOR_1464 = (MCG_C4_DRST_DRS(1) | MCG_C4_DMX32_MASK),
619 KINETIS_MCG_FLL_FACTOR_1920 = (MCG_C4_DRST_DRS(2)),
621 KINETIS_MCG_FLL_FACTOR_2197 = (MCG_C4_DRST_DRS(2) | MCG_C4_DMX32_MASK),
623 KINETIS_MCG_FLL_FACTOR_2560 = (MCG_C4_DRST_DRS(3)),
625 KINETIS_MCG_FLL_FACTOR_2929 = (MCG_C4_DRST_DRS(3) | MCG_C4_DMX32_MASK),
626} kinetis_mcg_fll_t;
627
628#endif /* MODULE_PERIPH_MCG */
629#if defined(MODULE_PERIPH_MCG) || defined(MODULE_PERIPH_MCG_LITE)
630
634typedef enum {
635 KINETIS_MCG_ERC_RANGE_LOW = MCG_C2_RANGE0(0),
636 KINETIS_MCG_ERC_RANGE_HIGH = MCG_C2_RANGE0(1),
637 KINETIS_MCG_ERC_RANGE_VERY_HIGH = MCG_C2_RANGE0(2),
638} kinetis_mcg_erc_range_t;
639
646typedef enum {
655 KINETIS_CLOCK_OSC0_EN = (1 << 0),
664 KINETIS_CLOCK_RTCOSC_EN = (1 << 1),
681 KINETIS_CLOCK_USE_FAST_IRC = (1 << 2),
690 KINETIS_CLOCK_MCGIRCLK_EN = (1 << 3),
701 KINETIS_CLOCK_MCGIRCLK_STOP_EN = (1 << 4),
712 KINETIS_CLOCK_MCGPCLK_EN = (1 << 5),
713} kinetis_clock_flags_t;
714
718typedef struct {
728 uint32_t clkdiv1;
740 uint32_t rtc_clc;
754 uint32_t osc32ksel;
760 unsigned int clock_flags;
766 kinetis_mcg_mode_t default_mode;
772 kinetis_mcg_erc_range_t erc_range;
783 uint8_t osc_clc;
784#ifdef MODULE_PERIPH_MCG
794 uint8_t oscsel;
795#endif /* MODULE_PERIPH_MCG */
807 uint8_t fcrdiv;
808#ifdef MODULE_PERIPH_MCG_LITE
820 uint8_t lirc_div2;
821#else
831 uint8_t fll_frdiv;
838 kinetis_mcg_fll_t fll_factor_fei;
845 kinetis_mcg_fll_t fll_factor_fee;
846#if KINETIS_HAVE_PLL
856 uint8_t pll_prdiv;
866 uint8_t pll_vdiv;
867#endif /* KINETIS_HAVE_PLL */
868#endif /* MODULE_PERIPH_MCG */
869} clock_config_t;
870#endif /* MODULE_PERIPH_MCG || MODULE_PERIPH_MCG_LITE */
877void gpio_init_port(gpio_t pin, uint32_t pcr);
878
879#ifdef __cplusplus
880}
881#endif
882
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_G
port G
Definition periph_cpu.h:49
@ PORT_C
port C
Definition periph_cpu.h:45
@ PORT_F
port F
Definition periph_cpu.h:48
@ PORT_E
port E
Definition periph_cpu.h:47
@ PORT_A
port A
Definition periph_cpu.h:43
@ PORT_D
port D
Definition periph_cpu.h:46
gpio_flank_t
Definition periph_cpu.h:176
@ GPIO_OUT
select GPIO MASK as output
Definition periph_cpu.h:161
@ GPIO_IN
select GPIO MASK as input
Definition periph_cpu.h:160
i2c_speed_t
Definition periph_cpu.h:272
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition periph_cpu.h:276
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition periph_cpu.h:273
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition periph_cpu.h:278
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:275
pwm_mode_t
@ PWM_CENTER
center aligned
@ PWM_LEFT
left aligned
@ PWM_RIGHT
right aligned
#define PWM_CHAN_MAX
PWM configuration structure.
uart_type_t
UART hardware module types.
Definition cpu_uart.h:36
#define GPIO_MODE(x, y)
Internal macro for combining pin mode (x) and pull-up/down (y).
Definition periph_cpu.h:147
enum IRQn IRQn_Type
Interrupt Number Definition.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:91
adc_res_t
Possible ADC resolution settings.
Definition adc.h:92
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition adc.h:98
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition adc.h:94
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition adc.h:97
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition adc.h:93
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition adc.h:95
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition adc.h:96
gpio_t spi_cs_t
Chip select pin type overlaps with gpio_t so it can be casted to this.
Definition spi.h:135
@ TIMER_PIT
PIT.
Definition periph_cpu.h:492
uart_type_t
UART hardware module types.
Definition periph_cpu.h:536
@ KINETIS_LPUART
Kinetis Low-power UART (LPUART) module type.
Definition periph_cpu.h:538
@ KINETIS_UART
Kinetis UART module type.
Definition periph_cpu.h:537
void gpio_init_port(gpio_t pin, uint32_t pcr)
CPU internal function for initializing PORTs.
uart_mode_t
UART transmission modes.
Definition periph_cpu.h:291
@ UART_MODE_8N1
8 data bits, no parity, 1 stop bit
Definition periph_cpu.h:293
@ UART_MODE_8E1
8 data bits, even parity, 1 stop bit
Definition periph_cpu.h:298
@ UART_MODE_8O1
8 data bits, odd parity, 1 stop bit
Definition periph_cpu.h:305
@ GPIO_PORTS_NUMOF
overall number of available ports
Definition periph_cpu.h:248
#define SPI_HWCS_NUMOF
Kinetis CPUs have a maximum number of 5 hardware chip select lines.
Definition periph_cpu.h:115
spi_mode_t
Support SPI modes.
Definition periph_cpu.h:42
@ SPI_MODE_0
CPOL=0, CPHA=0.
Definition periph_cpu.h:43
@ SPI_MODE_2
CPOL=1, CPHA=0.
Definition periph_cpu.h:45
@ SPI_MODE_1
CPOL=0, CPHA=1.
Definition periph_cpu.h:44
@ SPI_MODE_3
CPOL=1, CPHA=1.
Definition periph_cpu.h:46
Layered low power mode infrastructure.
ADC device configuration.
Definition periph_cpu.h:374
uint8_t avg
Hardware averaging configuration.
Definition periph_cpu.h:363
ADC_TypeDef * dev
ADC device used.
Definition periph_cpu.h:375
gpio_t pin
pin connected to the channel
Definition periph_cpu.h:287
uint8_t chan
CPU ADC channel connected to the pin.
Definition periph_cpu.h:289
DAC line configuration data.
Definition periph_cpu.h:300
I2C configuration structure.
Definition periph_cpu.h:295
i2c_speed_t speed
Configured bus speed, actual speed may be lower but never higher.
Definition periph_cpu.h:300
uint32_t freq
I2C module clock frequency, usually CLOCK_BUSCLOCK or CLOCK_CORECLOCK.
Definition periph_cpu.h:461
IRQn_Type irqn
I2C event interrupt number.
Definition periph_cpu.h:462
I2C_Type * i2c
Pointer to hardware module registers.
Definition periph_cpu.h:458
uint32_t sda_pcr
PORT module PCR setting for the SDA pin.
Definition periph_cpu.h:465
gpio_t sda_pin
SDA GPIO pin.
Definition periph_cpu.h:298
gpio_t scl_pin
SCL GPIO pin.
Definition periph_cpu.h:299
uint32_t scl_pcr
PORT module PCR setting for the SCL pin.
Definition periph_cpu.h:464
CPU specific timer PIT module configuration.
Definition periph_cpu.h:389
uint8_t prescaler_ch
Prescaler channel.
Definition periph_cpu.h:391
uint8_t count_ch
Counting channel, will be linked to the prescaler channel.
Definition periph_cpu.h:393
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
gpio_t pin_clk
CLK pin used.
Definition periph_cpu.h:475
spi_cs_t pin_cs[SPI_HWCS_NUMOF]
pins used for HW cs lines
Definition periph_cpu.h:476
gpio_t pin_mosi
MOSI pin used.
Definition periph_cpu.h:474
gpio_t pin_miso
MISO pin used.
Definition periph_cpu.h:473
uint32_t simmask
bit in the SIM register
Definition periph_cpu.h:485
UART device configuration.
Definition periph_cpu.h:214
uint8_t pinsel
PINSEL# of the RX and TX pin.
Definition periph_cpu.h:84
uart_type_t type
Hardware module type (KINETIS_UART or KINETIS_LPUART)
Definition periph_cpu.h:562
gpio_t pin_rx
RX pin, GPIO_UNDEF disables RX.
Definition periph_cpu.h:547
uint8_t irqn
IRQ channel.
Definition periph_cpu.h:335
gpio_t pin_tx
TX pin.
Definition periph_cpu.h:548
uint8_t scgc_bit
Clock enable bit, within the register.
Definition periph_cpu.h:560
uart_mode_t mode
UART mode: data bits, parity, stop bits.
Definition periph_cpu.h:561
volatile uint32_t * scgc_addr
Clock enable register, in SIM module.
Definition periph_cpu.h:559
uint32_t freq
Module clock frequency, usually CLOCK_CORECLOCK or CLOCK_BUSCLOCK.
Definition periph_cpu.h:546