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 
35 #define PM_NUM_MODES (3)
36 
42 #define PM_BLOCKER_INITIAL 0x00000001
43 
48 #define SAMD21_PM_STANDBY (0U)
49 #define SAMD21_PM_IDLE_2 (1U)
50 #define SAMD21_PM_IDLE_1 (2U)
51 #define SAMD21_PM_IDLE_0 (3U)
58 enum {
63 };
71 #define SPI_HWCS(x) (UINT_MAX - 1)
72 
76 typedef struct {
77  gpio_t pin;
79  uint8_t chan;
81 
85 typedef struct {
86  Tcc *dev;
88  const uint8_t chan_numof;
89 } pwm_conf_t;
90 
98 static inline int _sercom_id(SercomUsart *sercom)
99 {
100  return ((((uint32_t)sercom) >> 10) & 0x7) - 2;
101 }
102 
103 #ifndef DOXYGEN
104 
108 #define HAVE_ADC_RES_T
109 typedef enum {
110  ADC_RES_6BIT = 0xff,
111  ADC_RES_8BIT = ADC_CTRLB_RESSEL_8BIT,
112  ADC_RES_10BIT = ADC_CTRLB_RESSEL_10BIT,
113  ADC_RES_12BIT = ADC_CTRLB_RESSEL_12BIT,
114  ADC_RES_14BIT = 0xfe,
115  ADC_RES_16BIT = 0xfd
116 } adc_res_t;
118 #endif /* ndef DOXYGEN */
119 
123 #define DAC_RES_BITS (10)
124 
128 #define DAC_NUMOF (1)
129 
134 #define RTT_RUNSTDBY (1) /* Keep RTT running in sleep states */
135 
136 #define RTT_MAX_VALUE (0xffffffff)
137 #define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
138 #define RTT_MIN_FREQUENCY (RTT_CLOCK_FREQUENCY / 1024U) /* in Hz */
139 #define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */
140 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* PERIPH_CPU_H */
147 
48 MHz main clock
Definition: periph_cpu.h:59
ADC resolution: 12 bit.
Definition: adc.h:97
const pwm_conf_chan_t * chan
channel configuration
Definition: periph_cpu.h:87
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:93
gpio_mux_t mux
pin function multiplex value
Definition: periph_cpu.h:78
32 kHz clock
Definition: periph_cpu.h:61
PWM device configuration.
ADC resolution: 14 bit.
Definition: adc.h:98
gpio_t pin
GPIO pin.
Definition: periph_cpu.h:77
ADC resolution: 10 bit.
Definition: adc.h:96
1 kHz clock
Definition: periph_cpu.h:62
ADC resolution: 16 bit.
Definition: adc.h:99
gpio_mux_t
Available MUX values for configuring a pin&#39;s alternate function.
ADC resolution: 8 bit.
Definition: adc.h:95
ADC resolution: 6 bit.
Definition: adc.h:94
const uint8_t chan_numof
number of channels
Definition: periph_cpu.h:88
PWM channel configuration data structure.
Definition: periph_cpu.h:76
static int _sercom_id(SercomUsart *sercom)
Return the numeric id of a SERCOM device derived from its address.
Definition: periph_cpu.h:98
Tcc * dev
TCC device to use.
Definition: periph_cpu.h:86
1 MHz clock for xTimer
Definition: periph_cpu.h:60
uint8_t chan
TCC channel to use.
Definition: periph_cpu.h:79