periph.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 
9 #pragma once
10 
21 #if MODULE_SAUL_GPIO || DOXYGEN
22 #include "periph/gpio.h"
23 #endif /* MODULE_SAUL_GPIO */
24 
25 #if MODULE_SAUL_ADC || DOXYGEN
26 #include "periph/adc.h"
27 #endif /* MODULE_SAUL_ADC */
28 
29 #if MODULE_SAUL_PWM || DOXYGEN
30 #include "periph/pwm.h"
31 #endif /* MODULE_SAUL_PWM */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #if MODULE_SAUL_GPIO || DOXYGEN
41 typedef enum {
42  SAUL_GPIO_INVERTED = (1 << 0),
43  SAUL_GPIO_INIT_CLEAR = (1 << 1),
44  SAUL_GPIO_INIT_SET = (1 << 2),
46 
50 typedef struct {
51  const char *name;
52  gpio_t pin;
56 #endif /* MODULE_SAUL_GPIO */
57 
58 #if MODULE_SAUL_ADC || DOXYGEN
62 typedef struct {
63  const char *name;
67 #endif /* MODULE_SAUL_ADC */
68 
69 #if MODULE_SAUL_PWM || DOXYGEN
73 static const uint16_t saul_pwm_resolution = 255;
74 
78 typedef enum {
79  SAUL_PWM_REGULAR = (0 << 0),
82  SAUL_PWM_INVERTED = (1 << 0),
86 
93 typedef struct {
95  uint8_t channel;
98 
100 #define SAUL_PWM_FREQ_DEFAULT 1000
101 
115 /* This is not applied here as it would later need to be undef'd; actual
116  * application of the default happens in auto_init_saul_pwm.c */
117 #if DOXYGEN
118 #define SAUL_PWM_FREQ SAUL_PWM_FREQ_DEFAULT
119 #endif
120 
128 #if DOXYGEN
129 #define SAUL_PWM_NO_DIMMER
130 #endif
131 
140 typedef struct {
141  const char *name;
147 
155 #if DOXYGEN
156 #define SAUL_PWM_NO_RGB
157 #endif
158 
167 typedef struct {
168  const char *name;
170  saul_pwm_channel_t channels[3];
174 
175 #endif /* MODULE_SAUL_PWM */
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
Available pin modes.
Definition: periph_cpu.h:91
uint_fast8_t adc_t
Define default ADC type identifier.
Definition: adc.h:71
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:92
uint_fast8_t pwm_t
Default PWM type definition.
Definition: pwm.h:91
saul_gpio_flags_t
SAUL GPIO configuration flags.
Definition: periph.h:41
@ SAUL_GPIO_INIT_CLEAR
set pin inactive after init
Definition: periph.h:43
@ SAUL_GPIO_INIT_SET
set pin active after init
Definition: periph.h:44
@ SAUL_GPIO_INVERTED
pin is used as inverted
Definition: periph.h:42
saul_pwm_flags_t
SAUL PWM parameters.
Definition: periph.h:78
@ SAUL_PWM_INVERTED
Physical values are inverted from average voltage levels (ie.
Definition: periph.h:82
@ SAUL_PWM_REGULAR
Physical values are proportional to average voltage levels (ie.
Definition: periph.h:79
static const uint16_t saul_pwm_resolution
Resolution of SAUL mapped PWMs.
Definition: periph.h:73
Low-level PWM peripheral driver interface definitions.
Direct mapped ADC configuration values.
Definition: periph.h:62
adc_t line
ADC line to initialize and expose.
Definition: periph.h:64
const char * name
name of the device connected to this pin
Definition: periph.h:63
adc_res_t res
ADC resolution.
Definition: periph.h:65
Direct mapped GPIO configuration values.
Definition: periph.h:50
gpio_t pin
GPIO pin to initialize and expose.
Definition: periph.h:52
saul_gpio_flags_t flags
Configuration flags.
Definition: periph.h:54
gpio_mode_t mode
pin mode to use
Definition: periph.h:53
const char * name
name of the device connected to this pin
Definition: periph.h:51
Single PWM channel exposed via SAUL.
Definition: periph.h:93
uint8_t channel
Channel on the PWM device.
Definition: periph.h:95
pwm_t dev
PWM device backing this entry.
Definition: periph.h:94
saul_pwm_flags_t flags
Configuration flags.
Definition: periph.h:96
PWM channels mapped to dimmer-style registration entries.
Definition: periph.h:140
saul_pwm_channel_t channel
Full channel description (device, channel) along with flags that indicate whether high PWM values are...
Definition: periph.h:143
const char * name
Name of the device connected to this channel.
Definition: periph.h:141
PWM channels mapped to RGB LED registration entries.
Definition: periph.h:167
const char * name
Name of the device connected to these channels.
Definition: periph.h:168