Loading...
Searching...
No Matches
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
35extern "C" {
36#endif
37
38#if MODULE_SAUL_GPIO || DOXYGEN
42typedef enum {
43 SAUL_GPIO_INVERTED = (1 << 0),
45 SAUL_GPIO_INIT_SET = (1 << 2),
47
51typedef struct {
52 const char *name;
53 gpio_t pin;
57#endif /* MODULE_SAUL_GPIO */
58
59#if MODULE_SAUL_ADC || DOXYGEN
63typedef struct {
64 const char *name;
68#endif /* MODULE_SAUL_ADC */
69
70#if MODULE_SAUL_PWM || DOXYGEN
74static const uint16_t saul_pwm_resolution = 255;
75
79typedef enum {
80 SAUL_PWM_REGULAR = (0 << 0),
83 SAUL_PWM_INVERTED = (1 << 0),
87
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
148
156#if DOXYGEN
157#define SAUL_PWM_NO_RGB
158#endif
159
168typedef struct {
169 const char *name;
171 saul_pwm_channel_t channels[3];
175
176#endif /* MODULE_SAUL_PWM */
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif /* SAUL_PERIPH_H */
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:72
adc_res_t
Possible ADC resolution settings.
Definition adc.h:93
uint_fast8_t pwm_t
Default PWM type definition.
Definition pwm.h:92
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:82
saul_gpio_flags_t
SAUL GPIO configuration flags.
Definition periph.h:42
@ SAUL_GPIO_INIT_CLEAR
set pin inactive after init
Definition periph.h:44
@ SAUL_GPIO_INIT_SET
set pin active after init
Definition periph.h:45
@ SAUL_GPIO_INVERTED
pin is used as inverted
Definition periph.h:43
saul_pwm_flags_t
SAUL PWM parameters.
Definition periph.h:79
@ SAUL_PWM_INVERTED
Physical values are inverted from average voltage levels (ie.
Definition periph.h:83
@ SAUL_PWM_REGULAR
Physical values are proportional to average voltage levels (ie.
Definition periph.h:80
static const uint16_t saul_pwm_resolution
Resolution of SAUL mapped PWMs.
Definition periph.h:74
Low-level PWM peripheral driver interface definitions.
Direct mapped ADC configuration values.
Definition periph.h:63
adc_t line
ADC line to initialize and expose.
Definition periph.h:65
const char * name
name of the device connected to this pin
Definition periph.h:64
adc_res_t res
ADC resolution.
Definition periph.h:66
Direct mapped GPIO configuration values.
Definition periph.h:51
gpio_t pin
GPIO pin to initialize and expose.
Definition periph.h:53
saul_gpio_flags_t flags
Configuration flags.
Definition periph.h:55
gpio_mode_t mode
pin mode to use
Definition periph.h:54
const char * name
name of the device connected to this pin
Definition periph.h:52
Single PWM channel exposed via SAUL.
Definition periph.h:94
uint8_t channel
Channel on the PWM device.
Definition periph.h:96
pwm_t dev
PWM device backing this entry.
Definition periph.h:95
saul_pwm_flags_t flags
Configuration flags.
Definition periph.h:97
PWM channels mapped to dimmer-style registration entries.
Definition periph.h:141
saul_pwm_channel_t channel
Full channel description (device, channel) along with flags that indicate whether high PWM values are...
Definition periph.h:144
const char * name
Name of the device connected to this channel.
Definition periph.h:142
PWM channels mapped to RGB LED registration entries.
Definition periph.h:168
const char * name
Name of the device connected to these channels.
Definition periph.h:169