The friendly Operating System for the Internet of Things
ezr32wg/include/periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef CPU_PERIPH_H
20 #define CPU_PERIPH_H
21 
22 #include "cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 #define TIMER_UNDEF (0xffffffff)
32 
37 #define HAVE_TIMER_T
38 typedef uint32_t tim_t;
44 #define CPUID_LEN (8U)
45 
52 typedef struct {
53  TIMER_TypeDef *prescaler;
54  TIMER_TypeDef *timer;
55  uint8_t pre_cmu;
57  uint8_t irqn;
58 } timer_conf_t;
59 
64 #define HAVE_GPIO_T
65 typedef uint32_t gpio_t;
71 #define GPIO_UNDEF (0xffffffff)
72 
77 #define GPIO_PIN(x, y) ((x << 4) | y)
78 
82 enum {
83  PA = 0,
84  PB = 1,
85  PC = 2,
86  PD = 3,
87  PE = 4,
88  PF = 5
89 };
90 
91 #ifndef DOXYGEN
92 
96 #define HAVE_GPIO_MODE_T
97 typedef enum {
98  GPIO_IN = _GPIO_P_MODEL_MODE0_INPUT,
99  GPIO_IN_PD = _GPIO_P_MODEL_MODE0_INPUTPULL,
100  GPIO_IN_PU = _GPIO_P_MODEL_MODE0_INPUTPULL,
101  GPIO_OUT = _GPIO_P_MODEL_MODE0_PUSHPULL,
102  GPIO_OD = _GPIO_P_MODEL_MODE0_WIREDAND,
103  GPIO_OD_PU = _GPIO_P_MODEL_MODE0_WIREDANDPULLUP
104 } gpio_mode_t;
111 #define HAVE_GPIO_FLANK_T
112 typedef enum {
113  GPIO_FALLING = 2,
114  GPIO_RISING = 1,
115  GPIO_BOTH = 3
116 } gpio_flank_t;
118 #endif /* ndef DOXYGEN */
119 
123 typedef struct {
124  USART_TypeDef *dev;
125  gpio_t rx_pin;
126  gpio_t tx_pin;
127  uint8_t loc;
128  uint8_t cmu;
129  uint8_t irq;
130 } uart_conf_t;
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* CPU_PERIPH_H */
137 
USART_TypeDef * dev
USART device used.
emit interrupt on rising flank
Definition: gpio.h:114
uint8_t irq
the devices base IRQ channel
unsigned int tim_t
Default timer type.
Definition: timer.h:57
TIMER_TypeDef * timer
the higher numbered timer
uint8_t pre_cmu
prescale timer bit in CMU register, the timer bit is deducted from this
gpio_t rx_pin
Pin used for RX.
uint8_t loc
location of USART pins (AF)
emit interrupt on both flanks
Definition: gpio.h:115
gpio_flank_t
Definition of possible active flanks for external interrupt mode.
Definition: gpio.h:112
unsigned int gpio_t
GPIO type identifier.
Definition: gpio.h:69
gpio_t tx_pin
Pin used for TX.
emit interrupt on falling flank
Definition: gpio.h:113
input, pull-up
UART device configuration.
input, no pull
not supported
input, pull-down
uint8_t cmu
the device CMU channel
Timer configuration data.
TIMER_TypeDef * prescaler
the lower numbered neighboring timer