samd21/include/periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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 
20 #ifndef PERIPH_CPU_H
21 #define PERIPH_CPU_H
22 
23 #include <limits.h>
24 
25 #include "periph_cpu_common.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 static const int8_t exti_config[2][32] = {
35 #ifdef CPU_MODEL_SAMD21J18A
36  { 0, 1, 2, 3, 4, 5, 6, 7, -1, 9, 10, 11, 12, 13, 14, 15,
37  0, 1, 2, 3, 4, 5, 6, 7, 12, 13, -1, 15, 8, -1, 10, 11},
38  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
39  0, 1, -1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, 14, 15},
40 #elif CPU_MODEL_SAMD21G18A
41  { 0, 1, 2, 3, 4, 5, 6, 7, -1, 9, 10, 11, 12, 13, 14, 15,
42  0, 1, 2, 3, 4, 5, 6, 7, 12, 13, -1, 15, 8, -1, 10, 11},
43  {-1, -1, 2, 3, -1, -1, -1, -1, 8, 9, 10, 11, -1, -1, -1, -1,
44  -1, -1, -1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1},
45 #elif CPU_MODEL_SAMR21G18A
46  {-1, 1, -1, -1, 4, 5, 6, 7, -1, 9, 10, 11, 12, 13, 14, 15,
47  -1, 1, 2, 3, -1, -1, 6, 7, 12, 13, -1, 15, 8, -1, 10, 11},
48  { 0, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
49  0, 1, -1, -1, -1, -1, 6, 7, -1, -1, -1, -1, 8, -1, -1, -1},
50 #elif CPU_MODEL_SAMR21E18A
51  {-1, -1, -1, -1, -1, -1, 6, 7, -1, 9, 10, 11, -1, -1, 14, 15,
52  -1, 1, 2, 3, -1, -1, -1, -1, 12, 13, -1, 15, 8, -1, 10, 11},
53  { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
54  0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
55 #else
56  #error Please define a proper CPU_MODEL.
57 #endif
58 };
59 
65 #define SPI_HWCS(x) (UINT_MAX - 1)
66 
70 typedef struct {
71  gpio_t pin;
73  uint8_t chan;
75 
79 typedef struct {
80  Tcc *dev;
81  pwm_conf_chan_t chan[3];
82 } pwm_conf_t;
83 
91 static inline int _sercom_id(SercomUsart *sercom)
92 {
93  return ((((uint32_t)sercom) >> 10) & 0x7) - 2;
94 }
95 
100 #define HAVE_ADC_RES_T
101 typedef enum {
102  ADC_RES_6BIT = 0xff,
103  ADC_RES_8BIT = ADC_CTRLB_RESSEL_8BIT,
104  ADC_RES_10BIT = ADC_CTRLB_RESSEL_10BIT,
105  ADC_RES_12BIT = ADC_CTRLB_RESSEL_12BIT,
106  ADC_RES_14BIT = 0xfe,
108 } adc_res_t;
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* PERIPH_CPU_H */
115 
static const int8_t exti_config[2][32]
Mapping of pins to EXTI lines, -1 means not EXTI possible.
ADC resolution: 12 bit.
gpio_mux_t mux
pin function multiplex value
PWM device configuration.
ADC resolution: 10 bit.
gpio_mux_t
Available MUX values for configuring a pin&#39;s alternate function.
ADC resolution: 8 bit.
PWM channel configuration data structure.
static int _sercom_id(SercomUsart *sercom)
Return the numeric id of a SERCOM device derived from its address.
Tcc * dev
TCC device to use.
uint8_t chan
TCC channel to use.