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 
21 #ifndef PERIPH_CPU_H
22 #define PERIPH_CPU_H
23 
24 #include <stdint.h>
25 #include <stdbool.h>
26 
27 #include "cpu.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef PORT_PCR_MUX
34 # define KINETIS_HAVE_PCR
35 #endif
36 
37 #ifdef SIM_PINSEL_REG
38 # define KINETIS_HAVE_PINSEL
39 #endif
40 
41 #ifdef ADC_CFG1_MODE_MASK
42 # define KINETIS_HAVE_ADC_K
43 #endif
44 
45 #ifdef SPI_CTAR_CPHA_MASK
46 # define KINETIS_HAVE_MK_SPI
47 #endif
48 
49 #ifdef LPTMR_CSR_TEN_MASK
50 # define KINETIS_HAVE_LPTMR
51 #endif
52 
57 #define HAVE_GPIO_T
58 typedef uint16_t gpio_t;
64 #define GPIO_UNDEF (0xffff)
65 
69 #define GPIO_PIN(x, y) (((x + 1) << 12) | (x << 6) | y)
70 
71 #ifdef SIM_UIDH_UID_MASK
72 /* Kinetis Cortex-M4 has a 128 bit SIM UID */
76 #define CPUID_ADDR (&SIM->UIDH)
77 
81 #define CPUID_LEN (16U)
82 #else /* defined(SIM_UIDH_UID_MASK) */
83 /* Kinetis Cortex-M0+ has a 96 bit SIM UID */
87 #define CPUID_ADDR (&SIM->UIDMH)
88 
91 #define CPUID_LEN (12U)
92 #endif /* defined(SIM_UIDH_UID_MASK) */
93 
103 #define GPIO_MODE(pu, pe, od, out) (pu | (pe << 1) | (od << 5) | (out << 7))
104 
111 #define SPI_HWCS(x) (x)
112 
116 #define SPI_HWCS_NUMOF (5)
117 
122 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE 1
123 #define PERIPH_SPI_NEEDS_TRANSFER_REG 1
124 #define PERIPH_SPI_NEEDS_TRANSFER_REGS 1
125 
130 #define PERIPH_TIMER_PROVIDES_SET
131 
136 #define PM_NUM_MODES (3U)
137 enum {
138  KINETIS_PM_LLS = 0,
139  KINETIS_PM_VLPS = 1,
140  KINETIS_PM_STOP = 2,
141  KINETIS_PM_WAIT = 3,
142 };
143 #if MODULE_PM_LAYERED
144 #include "pm_layered.h"
148 #define PM_BLOCK(x) pm_block(x)
149 
152 #define PM_UNBLOCK(x) pm_unblock(x)
153 #else
154 /* ignore these calls when not using pm_layered */
155 #define PM_BLOCK(x)
156 #define PM_UNBLOCK(x)
157 #endif
158 
160 #ifdef RTC
161 /* All Kinetis CPUs have exactly one RTC hardware module, except for the KL02
162  * family which don't have an RTC at all */
167 #define RTT_FREQUENCY (1)
168 #define RTT_MAX_VALUE (0xffffffff)
169 
170 #endif
171 
172 #ifndef DOXYGEN
173 
177 #define HAVE_GPIO_MODE_T
178 typedef enum {
179  GPIO_IN = GPIO_MODE(0, 0, 0, 0),
180  GPIO_IN_PD = GPIO_MODE(0, 1, 0, 0),
181  GPIO_IN_PU = GPIO_MODE(1, 1, 0, 0),
182  GPIO_OUT = GPIO_MODE(0, 0, 0, 1),
183  GPIO_OD = GPIO_MODE(1, 0, 1, 1),
184  GPIO_OD_PU = GPIO_MODE(1, 1, 1, 1),
185 } gpio_mode_t;
187 #endif /* ndef DOXYGEN */
188 
189 #ifdef KINETIS_HAVE_PCR
190 
195 typedef enum {
196  GPIO_AF_ANALOG = PORT_PCR_MUX(0),
197  GPIO_AF_GPIO = PORT_PCR_MUX(1),
198  GPIO_AF_2 = PORT_PCR_MUX(2),
199  GPIO_AF_3 = PORT_PCR_MUX(3),
200  GPIO_AF_4 = PORT_PCR_MUX(4),
201  GPIO_AF_5 = PORT_PCR_MUX(5),
202  GPIO_AF_6 = PORT_PCR_MUX(6),
203  GPIO_AF_7 = PORT_PCR_MUX(7),
204 #ifdef PORT_PCR_ODE_MASK
205  GPIO_PCR_OD = (PORT_PCR_ODE_MASK),
206 #endif
207  GPIO_PCR_PD = (PORT_PCR_PE_MASK),
208  GPIO_PCR_PU = (PORT_PCR_PE_MASK | PORT_PCR_PS_MASK)
209 } gpio_pcr_t;
210 #endif /* KINETIS_HAVE_PCR */
211 
212 #ifndef DOXYGEN
213 
217 #ifdef KINETIS_HAVE_PCR
218 #define HAVE_GPIO_FLANK_T
219 typedef enum {
220  GPIO_RISING = PORT_PCR_IRQC(0x9),
221  GPIO_FALLING = PORT_PCR_IRQC(0xa),
222  GPIO_BOTH = PORT_PCR_IRQC(0xb),
223 } gpio_flank_t;
224 #endif /* KINETIS_HAVE_PCR */
225 
226 #endif /* ndef DOXYGEN */
227 
233 enum {
234  PORT_A = 0,
235  PORT_B = 1,
236  PORT_C = 2,
237  PORT_D = 3,
238  PORT_E = 4,
239  PORT_F = 5,
240  PORT_G = 6,
242 };
243 
244 #ifndef DOXYGEN
245 
249 #define HAVE_ADC_RES_T
250 #ifdef KINETIS_HAVE_ADC_K
251 typedef enum {
252  ADC_RES_6BIT = (0xfe),
253  ADC_RES_8BIT = ADC_CFG1_MODE(0),
254  ADC_RES_10BIT = ADC_CFG1_MODE(2),
255  ADC_RES_12BIT = ADC_CFG1_MODE(1),
256  ADC_RES_14BIT = (0xff),
257  ADC_RES_16BIT = ADC_CFG1_MODE(3)
258 } adc_res_t;
259 #endif /* KINETIS_HAVE_ADC_K */
260 
262 #if defined(FTM_CnSC_MSB_MASK)
263 
266 #define PWM_CHAN_MAX (4U)
267 
272 #define HAVE_PWM_MODE_T
273 typedef enum {
274  PWM_LEFT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK),
275  PWM_RIGHT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSA_MASK),
276  PWM_CENTER = (FTM_CnSC_MSB_MASK)
277 } pwm_mode_t;
278 #endif /* defined(FTM_CnSC_MSB_MASK) */
279 #endif /* ndef DOXYGEN */
280 
284 typedef enum {
288 #if defined(UART_C1_M_MASK) || DOXYGEN
289  /* LPUART and UART mode bits coincide, so the same setting for UART works on
290  * the LPUART as well */
291  UART_MODE_8E1 = (UART_C1_M_MASK | UART_C1_PE_MASK),
292 #elif defined(LPUART_CTRL_M_MASK)
293  /* For CPUs which only have the LPUART */
294  UART_MODE_8E1 = (LPUART_CTRL_M_MASK | LPUART_CTRL_PE_MASK),
295 #endif
297 #if defined(UART_C1_M_MASK) || DOXYGEN
298  UART_MODE_8O1 = (UART_C1_M_MASK | UART_C1_PE_MASK | UART_C1_PT_MASK),
299 #elif defined(LPUART_CTRL_M_MASK)
300  /* For CPUs which only have the LPUART */
301  UART_MODE_8O1 = (LPUART_CTRL_M_MASK | LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK),
302 #endif
303 } uart_mode_t;
304 
305 #ifndef DOXYGEN
306 
311 #ifdef KINETIS_HAVE_MK_SPI
312 #define HAVE_SPI_MODE_T
313 typedef enum {
314 #if defined(SPI_CTAR_CPHA_MASK)
315  SPI_MODE_0 = 0,
316  SPI_MODE_1 = (SPI_CTAR_CPHA_MASK),
317  SPI_MODE_2 = (SPI_CTAR_CPOL_MASK),
318  SPI_MODE_3 = (SPI_CTAR_CPOL_MASK | SPI_CTAR_CPHA_MASK)
319 #elif defined(SPI_C1_CPHA_MASK)
320  SPI_MODE_0 = 0,
321  SPI_MODE_1 = (SPI_C1_CPHA_MASK),
322  SPI_MODE_2 = (SPI_C1_CPOL_MASK),
323  SPI_MODE_3 = (SPI_C1_CPOL_MASK | SPI_C1_CPHA_MASK)
324 #endif
325 } spi_mode_t;
327 #endif /* KINETIS_HAVE_MK_SPI */
328 #endif /* ndef DOXYGEN */
329 
333 typedef struct {
337  ADC_Type *dev;
343  gpio_t pin;
350  uint8_t chan;
356  uint8_t avg;
357 } adc_conf_t;
358 
362 #define ADC_AVG_NONE (0)
363 
366 #define ADC_AVG_MAX (ADC_SC3_AVGE_MASK | ADC_SC3_AVGS(3))
367 
368 #if defined(DAC0_BASE) && (DAC0_BASE != This_symbol_has_been_deprecated)
369 
372 typedef struct {
373  DAC_Type *dev;
374  volatile uint32_t *scgc_addr;
375  uint8_t scgc_bit;
376 } dac_conf_t;
377 #endif
378 
382 typedef struct {
384  uint8_t prescaler_ch;
386  uint8_t count_ch;
387 } pit_conf_t;
388 
389 #ifdef KINETIS_HAVE_LPTMR
390 
393 typedef struct {
395  LPTMR_Type *dev;
397  uint32_t base_freq;
399  uint8_t src;
401  uint8_t irqn;
402 } lptmr_conf_t;
403 #endif /* KINETIS_HAVE_LPTMR */
404 
405 #ifdef FTM_CnSC_MSB_MASK
406 
409 typedef struct {
410  FTM_Type* ftm;
411  struct {
412  gpio_t pin;
413  uint8_t af;
414  uint8_t ftm_chan;
415  } chan[PWM_CHAN_MAX];
416  uint8_t chan_numof;
417  uint8_t ftm_num;
418 #ifdef KINETIS_HAVE_PINSEL
419  volatile uint32_t *pinsel;
420  uint32_t pinsel_mask;
421  uint32_t pinsel_val;
422 #endif
423 } pwm_conf_t;
424 #endif
425 
426 #ifndef DOXYGEN
427 #define HAVE_I2C_SPEED_T
428 typedef enum {
429  I2C_SPEED_LOW = 10000ul,
430  I2C_SPEED_NORMAL = 100000ul,
431  I2C_SPEED_FAST = 400000ul,
432  I2C_SPEED_FAST_PLUS = 1000000ul,
433  /* High speed is not supported without external hardware hacks */
434  I2C_SPEED_HIGH = 3400000ul,
435 } i2c_speed_t;
440 #define PERIPH_I2C_NEED_READ_REG
441 #define PERIPH_I2C_NEED_READ_REGS
442 #define PERIPH_I2C_NEED_WRITE_REG
443 #define PERIPH_I2C_NEED_WRITE_REGS
444 
445 #endif /* !defined(DOXYGEN) */
446 
450 typedef struct {
451  I2C_Type *i2c;
452  gpio_t scl_pin;
453  gpio_t sda_pin;
454  uint32_t freq;
455  i2c_speed_t speed;
457  uint32_t scl_pcr;
458  uint32_t sda_pcr;
459 } i2c_conf_t;
460 
464 typedef struct {
465  SPI_Type *dev;
466  gpio_t pin_miso;
467  gpio_t pin_mosi;
468  gpio_t pin_clk;
469  gpio_t pin_cs[SPI_HWCS_NUMOF];
470 #ifdef KINETIS_HAVE_PCR
471  gpio_pcr_t pcr;
472 #endif /* KINETIS_HAVE_PCR */
473 #ifdef KINETIS_HAVE_PINSEL
474  volatile uint32_t *pinsel;
475  uint32_t pinsel_mask;
476  uint32_t pinsel_val;
477 #endif
478  uint32_t simmask;
479 } spi_conf_t;
480 
484 enum {
486 #ifdef KINETIS_HAVE_LPTMR
487  TIMER_LPTMR,
488 #endif /* KINETIS_HAVE_LPTMR */
489 };
490 
496 #define TIMER_PIT_DEV(x) (TIMER_DEV(0 + (x)))
497 #ifdef KINETIS_HAVE_LPTMR
498 
499 #define TIMER_LPTMR_DEV(x) (TIMER_DEV(PIT_NUMOF + (x)))
500 #endif /* KINETIS_HAVE_LPTMR */
501 
506 typedef enum {
509 } uart_type_t;
510 
514 typedef struct {
515  void *dev;
516  uint32_t freq;
517  gpio_t pin_rx;
518  gpio_t pin_tx;
519 #ifdef KINETIS_HAVE_PCR
520  uint32_t pcr_rx;
521  uint32_t pcr_tx;
522 #endif
523 #ifdef KINETIS_HAVE_PINSEL
524  volatile uint32_t *pinsel;
525  uint32_t pinsel_mask;
526  uint32_t pinsel_val;
527 #endif
529  volatile uint32_t *scgc_addr;
530  uint8_t scgc_bit;
533 } uart_conf_t;
534 
535 #if !defined(KINETIS_HAVE_PLL) && defined(MODULE_PERIPH_MCG) \
536  && defined(MCG_C6_PLLS_MASK) || DOXYGEN
537 
540 #define KINETIS_HAVE_PLL 1
541 #else
542 #define KINETIS_HAVE_PLL 0
543 #endif
544 
545 #ifdef MODULE_PERIPH_MCG_LITE
546 
549 typedef enum kinetis_mcg_mode {
550  KINETIS_MCG_MODE_LIRC8M = 0,
551  KINETIS_MCG_MODE_HIRC = 1,
552  KINETIS_MCG_MODE_EXT = 2,
553  KINETIS_MCG_MODE_LIRC2M = 3,
554  KINETIS_MCG_MODE_NUMOF,
555 } kinetis_mcg_mode_t;
556 #endif /* MODULE_PERIPH_MCG_LITE */
557 
558 #ifdef MODULE_PERIPH_MCG
559 
562 typedef enum kinetis_mcg_mode {
563  KINETIS_MCG_MODE_FEI = 0,
564  KINETIS_MCG_MODE_FEE = 1,
565  KINETIS_MCG_MODE_FBI = 2,
566  KINETIS_MCG_MODE_FBE = 3,
567  KINETIS_MCG_MODE_BLPI = 4,
568  KINETIS_MCG_MODE_BLPE = 5,
569 #if KINETIS_HAVE_PLL
570  KINETIS_MCG_MODE_PBE = 6,
571  KINETIS_MCG_MODE_PEE = 7,
572 #endif
573  KINETIS_MCG_MODE_NUMOF,
574 } kinetis_mcg_mode_t;
575 
579 typedef enum {
581  KINETIS_MCG_FLL_FACTOR_640 = (MCG_C4_DRST_DRS(0)),
583  KINETIS_MCG_FLL_FACTOR_732 = (MCG_C4_DRST_DRS(0) | MCG_C4_DMX32_MASK),
585  KINETIS_MCG_FLL_FACTOR_1280 = (MCG_C4_DRST_DRS(1)),
587  KINETIS_MCG_FLL_FACTOR_1464 = (MCG_C4_DRST_DRS(1) | MCG_C4_DMX32_MASK),
589  KINETIS_MCG_FLL_FACTOR_1920 = (MCG_C4_DRST_DRS(2)),
591  KINETIS_MCG_FLL_FACTOR_2197 = (MCG_C4_DRST_DRS(2) | MCG_C4_DMX32_MASK),
593  KINETIS_MCG_FLL_FACTOR_2560 = (MCG_C4_DRST_DRS(3)),
595  KINETIS_MCG_FLL_FACTOR_2929 = (MCG_C4_DRST_DRS(3) | MCG_C4_DMX32_MASK),
596 } kinetis_mcg_fll_t;
597 
598 #endif /* MODULE_PERIPH_MCG */
599 #if defined(MODULE_PERIPH_MCG) || defined(MODULE_PERIPH_MCG_LITE)
600 
604 typedef enum {
605  KINETIS_MCG_ERC_RANGE_LOW = MCG_C2_RANGE0(0),
606  KINETIS_MCG_ERC_RANGE_HIGH = MCG_C2_RANGE0(1),
607  KINETIS_MCG_ERC_RANGE_VERY_HIGH = MCG_C2_RANGE0(2),
608 } kinetis_mcg_erc_range_t;
609 
616 typedef enum {
625  KINETIS_CLOCK_OSC0_EN = (1 << 0),
634  KINETIS_CLOCK_RTCOSC_EN = (1 << 1),
651  KINETIS_CLOCK_USE_FAST_IRC = (1 << 2),
660  KINETIS_CLOCK_MCGIRCLK_EN = (1 << 3),
671  KINETIS_CLOCK_MCGIRCLK_STOP_EN = (1 << 4),
682  KINETIS_CLOCK_MCGPCLK_EN = (1 << 5),
683 } kinetis_clock_flags_t;
684 
688 typedef struct {
698  uint32_t clkdiv1;
710  uint32_t rtc_clc;
724  uint32_t osc32ksel;
730  unsigned int clock_flags;
736  kinetis_mcg_mode_t default_mode;
742  kinetis_mcg_erc_range_t erc_range;
753  uint8_t osc_clc;
754 #ifdef MODULE_PERIPH_MCG
755 
764  uint8_t oscsel;
765 #endif /* MODULE_PERIPH_MCG */
766 
777  uint8_t fcrdiv;
778 #ifdef MODULE_PERIPH_MCG_LITE
779 
790  uint8_t lirc_div2;
791 #else
792 
801  uint8_t fll_frdiv;
808  kinetis_mcg_fll_t fll_factor_fei;
815  kinetis_mcg_fll_t fll_factor_fee;
816 #if KINETIS_HAVE_PLL
817 
826  uint8_t pll_prdiv;
836  uint8_t pll_vdiv;
837 #endif /* KINETIS_HAVE_PLL */
838 #endif /* MODULE_PERIPH_MCG */
839 } clock_config_t;
840 #endif /* MODULE_PERIPH_MCG || MODULE_PERIPH_MCG_LITE */
841 
847 void gpio_init_port(gpio_t pin, uint32_t pcr);
848 
849 #ifdef __cplusplus
850 }
851 #endif
852 
853 #endif /* PERIPH_CPU_H */
854 
SPI_MODE_3
@ SPI_MODE_3
CPOL=1, CPHA=1.
Definition: spi.h:161
PORT_E
@ PORT_E
port E
Definition: periph_cpu.h:40
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
ADC_RES_6BIT
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition: adc.h:94
I2C_SPEED_LOW
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition: i2c.h:176
GPIO_PORTS_NUMOF
@ GPIO_PORTS_NUMOF
overall number of available ports
Definition: periph_cpu.h:241
GPIO_IN_PD
@ GPIO_IN_PD
configure as input with pull-down resistor
Definition: gpio.h:120
uart_conf_t::irqn
IRQn_Type irqn
IRQ number for this module.
Definition: periph_cpu.h:528
SPI_HWCS_NUMOF
#define SPI_HWCS_NUMOF
Kinetis CPUs have a maximum number of 5 hardware chip select lines.
Definition: periph_cpu.h:116
i2c_conf_t::irqn
IRQn_Type irqn
IRQ number for this module.
Definition: periph_cpu.h:456
SPI_MODE_0
@ SPI_MODE_0
CPOL=0, CPHA=0.
Definition: spi.h:158
GPIO_OD
@ GPIO_OD
configure as output in open-drain mode without pull resistor
Definition: gpio.h:123
I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: i2c.h:177
IRQn_Type
enum IRQn IRQn_Type
Interrupt Number Definition.
pit_conf_t
CPU specific timer PIT module configuration.
Definition: periph_cpu.h:382
adc_conf_t::dev
ADC_Type * dev
ADC module.
Definition: periph_cpu.h:337
ADC_RES_14BIT
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition: adc.h:98
adc_res_t
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:93
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
PORT_D
@ PORT_D
port D
Definition: periph_cpu.h:39
KINETIS_UART
@ KINETIS_UART
Kinetis UART module type.
Definition: periph_cpu.h:507
uart_conf_t::pin_rx
gpio_t pin_rx
RX pin, GPIO_UNDEF disables RX.
Definition: periph_cpu.h:517
pit_conf_t::count_ch
uint8_t count_ch
Counting channel, will be linked to the prescaler channel.
Definition: periph_cpu.h:386
GPIO_MODE
#define GPIO_MODE(pu, pe, od, out)
Generate GPIO mode bitfields.
Definition: periph_cpu.h:103
GPIO_OUT
@ GPIO_OUT
configure as output in push-pull mode
Definition: gpio.h:122
ADC_RES_16BIT
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition: adc.h:99
i2c_speed_t
i2c_speed_t
Default mapping of I2C bus speed values.
Definition: i2c.h:175
spi_mode_t
spi_mode_t
Available SPI modes, defining the configuration of clock polarity and clock phase.
Definition: spi.h:157
UART_MODE_8N1
@ UART_MODE_8N1
8 data bits, no parity, 1 stop bit
Definition: periph_cpu.h:286
uart_conf_t::type
uart_type_t type
Hardware module type (KINETIS_UART or KINETIS_LPUART)
Definition: periph_cpu.h:532
ADC_RES_8BIT
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition: adc.h:95
adc_conf_t::pin
gpio_t pin
pin to use
Definition: periph_cpu.h:343
GPIO_FALLING
@ GPIO_FALLING
emit interrupt on falling flank
Definition: periph_cpu.h:81
i2c_conf_t::scl_pcr
uint32_t scl_pcr
PORT module PCR setting for the SCL pin.
Definition: periph_cpu.h:457
uart_conf_t::scgc_addr
volatile uint32_t * scgc_addr
Clock enable register, in SIM module.
Definition: periph_cpu.h:529
spi_conf_t::pin_clk
gpio_t pin_clk
CLK pin used.
Definition: periph_cpu.h:468
GPIO_IN_PU
@ GPIO_IN_PU
configure as input with pull-up resistor
Definition: gpio.h:121
spi_conf_t::pin_miso
gpio_t pin_miso
MISO pin used.
Definition: periph_cpu.h:466
GPIO_RISING
@ GPIO_RISING
emit interrupt on rising flank
Definition: periph_cpu.h:82
i2c_conf_t::i2c
I2C_Type * i2c
Pointer to hardware module registers.
Definition: periph_cpu.h:451
pwm_conf_t
PWM device configuration.
Definition: periph_cpu_common.h:153
PWM_LEFT
@ PWM_LEFT
left aligned PWM
Definition: periph_cpu.h:160
UART_MODE_8O1
@ UART_MODE_8O1
8 data bits, odd parity, 1 stop bit
Definition: periph_cpu.h:298
KINETIS_LPUART
@ KINETIS_LPUART
Kinetis Low-power UART (LPUART) module type.
Definition: periph_cpu.h:508
gpio_init_port
void gpio_init_port(gpio_t pin, uint32_t pcr)
CPU internal function for initializing PORTs.
TIMER_PIT
@ TIMER_PIT
PIT.
Definition: periph_cpu.h:485
GPIO_IN
@ GPIO_IN
configure as input without pull resistor
Definition: gpio.h:119
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
PORT_F
@ PORT_F
port F
Definition: periph_cpu.h:41
gpio_flank_t
gpio_flank_t
Definition: periph_cpu.h:80
dac_conf_t
DAC line configuration data.
Definition: periph_cpu.h:518
GPIO_OD_PU
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
Definition: gpio.h:125
PWM_RIGHT
@ PWM_RIGHT
right aligned PWM
Definition: periph_cpu.h:161
uart_conf_t::mode
uart_mode_t mode
UART mode: data bits, parity, stop bits.
Definition: periph_cpu.h:531
UART_MODE_8E1
@ UART_MODE_8E1
8 data bits, even parity, 1 stop bit
Definition: periph_cpu.h:291
GPIO_BOTH
@ GPIO_BOTH
emit interrupt on both flanks
Definition: periph_cpu.h:83
adc_conf_t::avg
uint8_t avg
Hardware averaging configuration.
Definition: periph_cpu.h:356
adc_conf_t
gpio_t adc_conf_t
ADC configuration wrapper.
Definition: periph_cpu.h:315
i2c_conf_t::freq
uint32_t freq
I2C module clock frequency, usually CLOCK_BUSCLOCK or CLOCK_CORECLOCK.
Definition: periph_cpu.h:454
gpio_mode_t
gpio_mode_t
Available pin modes.
Definition: periph_cpu.h:70
ADC_RES_10BIT
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition: adc.h:96
ADC_RES_12BIT
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition: adc.h:97
uart_conf_t::scgc_bit
uint8_t scgc_bit
Clock enable bit, within the register.
Definition: periph_cpu.h:530
gpio_t
unsigned int gpio_t
GPIO type identifier.
Definition: gpio.h:91
spi_conf_t::simmask
uint32_t simmask
bit in the SIM register
Definition: periph_cpu.h:478
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
I2C_SPEED_FAST_PLUS
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition: i2c.h:179
uart_type_t
uart_type_t
UART hardware module types.
Definition: periph_cpu.h:506
I2C_SPEED_FAST
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition: i2c.h:178
uart_conf_t::freq
uint32_t freq
Module clock frequency, usually CLOCK_CORECLOCK or CLOCK_BUSCLOCK.
Definition: periph_cpu.h:516
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
PORT_G
@ PORT_G
port G
Definition: periph_cpu.h:42
pwm_mode_t
pwm_mode_t
Definition: periph_cpu.h:159
adc_conf_t::chan
uint8_t chan
ADC channel.
Definition: periph_cpu.h:350
I2C_SPEED_HIGH
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition: i2c.h:180
uart_conf_t::pin_tx
gpio_t pin_tx
TX pin.
Definition: periph_cpu.h:518
i2c_conf_t::sda_pcr
uint32_t sda_pcr
PORT module PCR setting for the SDA pin.
Definition: periph_cpu.h:458
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
SPI_MODE_1
@ SPI_MODE_1
CPOL=0, CPHA=1.
Definition: spi.h:159
spi_conf_t::pin_mosi
gpio_t pin_mosi
MOSI pin used.
Definition: periph_cpu.h:467
pit_conf_t::prescaler_ch
uint8_t prescaler_ch
Prescaler channel.
Definition: periph_cpu.h:384
pm_layered.h
Layered low power mode infrastructure.
uart_mode_t
uart_mode_t
UART transmission modes.
Definition: periph_cpu.h:284
PWM_CENTER
@ PWM_CENTER
not supported
Definition: periph_cpu.h:162
SPI_MODE_2
@ SPI_MODE_2
CPOL=1, CPHA=0.
Definition: spi.h:160
PWM_CHAN_MAX
#define PWM_CHAN_MAX
PWM configuration structure.
Definition: periph_conf.h:229