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 
19 #ifndef SAUL_PERIPH_H
20 #define SAUL_PERIPH_H
21 
22 #if MODULE_SAUL_GPIO || DOXYGEN
23 #include "periph/gpio.h"
24 #endif /* MODULE_SAUL_GPIO */
25 
26 #if MODULE_SAUL_ADC || DOXYGEN
27 #include "periph/adc.h"
28 #endif /* MODULE_SAUL_ADC */
29 
30 #if MODULE_SAUL_PWM || DOXYGEN
31 #include "periph/pwm.h"
32 #endif /* MODULE_SAUL_PWM */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #if MODULE_SAUL_GPIO || DOXYGEN
39 
42 typedef enum {
43  SAUL_GPIO_INVERTED = (1 << 0),
44  SAUL_GPIO_INIT_CLEAR = (1 << 1),
45  SAUL_GPIO_INIT_SET = (1 << 2),
47 
51 typedef struct {
52  const char *name;
53  gpio_t pin;
57 #endif /* MODULE_SAUL_GPIO */
58 
59 #if MODULE_SAUL_ADC || DOXYGEN
60 
63 typedef struct {
64  const char *name;
68 #endif /* MODULE_SAUL_ADC */
69 
70 #if MODULE_SAUL_PWM || DOXYGEN
71 
74 static const uint16_t saul_pwm_resolution = 255;
75 
79 typedef enum {
80  SAUL_PWM_REGULAR = (0 << 0),
83  SAUL_PWM_INVERTED = (1 << 0),
87 
94 typedef struct {
96  uint8_t channel;
99 
101 #define SAUL_PWM_FREQ_DEFAULT 1000
102 
116 /* This is not applied here as it would later need to be undef'd; actual
117  * application of the default happens in auto_init_saul_pwm.c */
118 #if DOXYGEN
119 #define SAUL_PWM_FREQ SAUL_PWM_FREQ_DEFAULT
120 #endif
121 
129 #if DOXYGEN
130 #define SAUL_PWM_NO_DIMMER
131 #endif
132 
141 typedef struct {
142  const char *name;
148 
156 #if DOXYGEN
157 #define SAUL_PWM_NO_RGB
158 #endif
159 
168 typedef struct {
169  const char *name;
171  saul_pwm_channel_t channels[3];
175 
176 
177 #endif /* MODULE_SAUL_PWM */
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* SAUL_PERIPH_H */
184 
saul_pwm_channel_t::channel
uint8_t channel
Channel on the PWM device.
Definition: periph.h:96
saul_pwm_dimmer_params_t::name
const char * name
Name of the device connected to this channel.
Definition: periph.h:142
saul_adc_params_t::line
adc_t line
ADC line to initialize and expose.
Definition: periph.h:65
saul_pwm_channel_t::dev
pwm_t dev
PWM device backing this entry.
Definition: periph.h:95
saul_gpio_params_t::pin
gpio_t pin
GPIO pin to initialize and expose.
Definition: periph.h:53
adc_t
unsigned int adc_t
Define default ADC type identifier.
Definition: adc.h:72
saul_pwm_rgb_params_t::name
const char * name
Name of the device connected to these channels.
Definition: periph.h:169
saul_pwm_dimmer_params_t::channel
saul_pwm_channel_t channel
Full channel description (device, channel) along with flags that indicate whether high PWM values are...
Definition: periph.h:144
adc_res_t
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:93
adc.h
Low-level ADC peripheral driver interface definitions.
saul_pwm_channel_t::flags
saul_pwm_flags_t flags
Configuration flags.
Definition: periph.h:97
saul_pwm_channel_t
Single PWM channel exposed via SAUL.
Definition: periph.h:94
SAUL_PWM_INVERTED
@ SAUL_PWM_INVERTED
Physical values are inverted from average voltage levels (ie.
Definition: periph.h:83
SAUL_PWM_REGULAR
@ SAUL_PWM_REGULAR
Physical values are proportional to average voltage levels (ie.
Definition: periph.h:80
saul_gpio_params_t::name
const char * name
name of the device connected to this pin
Definition: periph.h:52
SAUL_GPIO_INIT_SET
@ SAUL_GPIO_INIT_SET
set pin active after init
Definition: periph.h:45
saul_adc_params_t::res
adc_res_t res
ADC resolution.
Definition: periph.h:66
saul_gpio_params_t::mode
gpio_mode_t mode
pin mode to use
Definition: periph.h:54
SAUL_GPIO_INIT_CLEAR
@ SAUL_GPIO_INIT_CLEAR
set pin inactive after init
Definition: periph.h:44
saul_pwm_rgb_params_t
PWM channels mapped to RGB LED registration entries.
Definition: periph.h:168
saul_pwm_resolution
static const uint16_t saul_pwm_resolution
Resolution of SAUL mapped PWMs.
Definition: periph.h:74
saul_pwm_flags_t
saul_pwm_flags_t
SAUL PWM parameters.
Definition: periph.h:79
saul_gpio_flags_t
saul_gpio_flags_t
SAUL GPIO configuration flags.
Definition: periph.h:42
gpio.h
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
gpio_mode_t
Available pin modes.
Definition: periph_cpu.h:70
saul_gpio_params_t
Direct mapped GPIO configuration values.
Definition: periph.h:51
saul_adc_params_t
Direct mapped ADC configuration values.
Definition: periph.h:63
SAUL_GPIO_INVERTED
@ SAUL_GPIO_INVERTED
pin is used as inverted
Definition: periph.h:43
saul_pwm_dimmer_params_t
PWM channels mapped to dimmer-style registration entries.
Definition: periph.h:141
saul_gpio_params_t::flags
saul_gpio_flags_t flags
Configuration flags.
Definition: periph.h:55
pwm.h
Low-level PWM peripheral driver interface definitions.
pwm_t
unsigned int pwm_t
Default PWM type definition.
Definition: pwm.h:92
saul_adc_params_t::name
const char * name
name of the device connected to this pin
Definition: periph.h:64