periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 ML!PA Consulting GmbH
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 "macros/units.h"
26 #include "periph_cpu_common.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #define SAM0_DFLL_FREQ_HZ MHZ(48)
36 
40 #define SAM0_XOSC_FREQ_HZ (XOSC0_FREQUENCY ? XOSC0_FREQUENCY : XOSC1_FREQUENCY)
41 
45 #define SAM0_DPLL_FREQ_MIN_HZ MHZ(96)
46 
50 #define SAM0_DPLL_FREQ_MAX_HZ MHZ(20)
51 
56 #define PM_NUM_MODES (3)
57 
63 enum {
68 };
75 #define SAM0_GCLK_8MHZ SAM0_GCLK_TIMER
76 #define SAM0_GCLK_48MHZ SAM0_GCLK_PERIPH
77 
84 #define SPI_HWCS(x) (UINT_MAX - 1)
85 
86 #ifndef DOXYGEN
87 #define HAVE_ADC_RES_T
88 typedef enum {
89  ADC_RES_6BIT = 0xff,
90  ADC_RES_8BIT = ADC_CTRLB_RESSEL_8BIT,
91  ADC_RES_10BIT = ADC_CTRLB_RESSEL_10BIT,
92  ADC_RES_12BIT = ADC_CTRLB_RESSEL_12BIT,
93  ADC_RES_14BIT = 0xfe,
94  ADC_RES_16BIT = 0xfd
95 } adc_res_t;
97 #endif /* DOXYGEN */
98 
102 #define DAC_RES_BITS (12)
103 
107 #define DAC_NUMOF (2)
108 
113 #define RTT_MAX_VALUE (0xffffffff)
114 #define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
115 #define RTT_MIN_FREQUENCY (RTT_CLOCK_FREQUENCY / 1024U) /* in Hz */
116 #define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */
117 
123 static const gpio_t rtc_tamper_pins[RTC_NUM_OF_TAMPERS] = {
124  GPIO_PIN(PB, 0), GPIO_PIN(PB, 2), GPIO_PIN(PA, 2),
125  GPIO_PIN(PC, 0), GPIO_PIN(PC, 1)
126 };
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* PERIPH_CPU_H */
133 
port B
Definition: periph_cpu.h:93
ADC resolution: 12 bit.
Definition: adc.h:97
port C
Definition: periph_cpu.h:94
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:93
12-48 MHz (DFLL) clock
Definition: periph_cpu.h:67
4-8 MHz clock for xTimer
Definition: periph_cpu.h:66
static const gpio_t rtc_tamper_pins[RTC_NUM_OF_TAMPERS]
RTC input pins that can be used for tamper detection and wake from Deep Sleep.
Definition: periph_cpu.h:123
ADC resolution: 14 bit.
Definition: adc.h:98
ADC resolution: 10 bit.
Definition: adc.h:96
ADC resolution: 16 bit.
Definition: adc.h:99
ADC resolution: 8 bit.
Definition: adc.h:95
ADC resolution: 6 bit.
Definition: adc.h:94
Unit helper macros.
32 kHz clock
Definition: periph_cpu.h:61
port A
Definition: periph_cpu.h:92
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
48 MHz main clock
Definition: periph_cpu.h:59