Loading...
Searching...
No Matches
periph.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#if MODULE_SAUL_GPIO || DOXYGEN
19#include "periph/gpio.h"
20#endif /* MODULE_SAUL_GPIO */
21
22#if MODULE_SAUL_ADC || DOXYGEN
23#include "periph/adc.h"
24#endif /* MODULE_SAUL_ADC */
25
26#if MODULE_SAUL_PWM || DOXYGEN
27#include "periph/pwm.h"
28#endif /* MODULE_SAUL_PWM */
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#if MODULE_SAUL_GPIO || DOXYGEN
38typedef enum {
39 SAUL_GPIO_INVERTED = (1 << 0),
41 SAUL_GPIO_INIT_SET = (1 << 2),
43
47typedef struct {
48 const char *name;
49 gpio_t pin;
53#endif /* MODULE_SAUL_GPIO */
54
55#if MODULE_SAUL_ADC || DOXYGEN
59typedef struct {
60 const char *name;
64#endif /* MODULE_SAUL_ADC */
65
66#if MODULE_SAUL_PWM || DOXYGEN
70static const uint16_t saul_pwm_resolution = 255;
71
75typedef enum {
76 SAUL_PWM_REGULAR = (0 << 0),
79 SAUL_PWM_INVERTED = (1 << 0),
83
95
97#define SAUL_PWM_FREQ_DEFAULT 1000
98
112/* This is not applied here as it would later need to be undef'd; actual
113 * application of the default happens in auto_init_saul_pwm.c */
114#if DOXYGEN
115#define SAUL_PWM_FREQ SAUL_PWM_FREQ_DEFAULT
116#endif
117
125#if DOXYGEN
126#define SAUL_PWM_NO_DIMMER
127#endif
128
144
152#if DOXYGEN
153#define SAUL_PWM_NO_RGB
154#endif
155
164typedef struct {
165 const char *name;
171
172#endif /* MODULE_SAUL_PWM */
173
174#ifdef __cplusplus
175}
176#endif
177
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:96
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:68
adc_res_t
Possible ADC resolution settings.
Definition adc.h:89
uint_fast8_t pwm_t
Default PWM type definition.
Definition pwm.h:88
saul_gpio_flags_t
SAUL GPIO configuration flags.
Definition periph.h:38
@ SAUL_GPIO_INIT_CLEAR
set pin inactive after init
Definition periph.h:40
@ SAUL_GPIO_INIT_SET
set pin active after init
Definition periph.h:41
@ SAUL_GPIO_INVERTED
pin is used as inverted
Definition periph.h:39
saul_pwm_flags_t
SAUL PWM parameters.
Definition periph.h:75
@ SAUL_PWM_INVERTED
Physical values are inverted from average voltage levels (ie.
Definition periph.h:79
@ SAUL_PWM_REGULAR
Physical values are proportional to average voltage levels (ie.
Definition periph.h:76
static const uint16_t saul_pwm_resolution
Resolution of SAUL mapped PWMs.
Definition periph.h:70
Low-level PWM peripheral driver interface definitions.
Direct mapped ADC configuration values.
Definition periph.h:59
adc_t line
ADC line to initialize and expose.
Definition periph.h:61
const char * name
name of the device connected to this pin
Definition periph.h:60
adc_res_t res
ADC resolution.
Definition periph.h:62
Direct mapped GPIO configuration values.
Definition periph.h:47
gpio_t pin
GPIO pin to initialize and expose.
Definition periph.h:49
saul_gpio_flags_t flags
Configuration flags.
Definition periph.h:51
gpio_mode_t mode
pin mode to use
Definition periph.h:50
const char * name
name of the device connected to this pin
Definition periph.h:48
Single PWM channel exposed via SAUL.
Definition periph.h:90
uint8_t channel
Channel on the PWM device.
Definition periph.h:92
pwm_t dev
PWM device backing this entry.
Definition periph.h:91
saul_pwm_flags_t flags
Configuration flags.
Definition periph.h:93
PWM channels mapped to dimmer-style registration entries.
Definition periph.h:137
saul_pwm_channel_t channel
Full channel description (device, channel) along with flags that indicate whether high PWM values are...
Definition periph.h:140
const char * name
Name of the device connected to this channel.
Definition periph.h:138
PWM channels mapped to RGB LED registration entries.
Definition periph.h:164
saul_pwm_channel_t channels[3]
Full channel description (device, channel) along with flags that indicate whether high PWM values are...
Definition periph.h:167
const char * name
Name of the device connected to these channels.
Definition periph.h:165