periph.h
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (C) 2015 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup drivers_saul
* @{
*
* @file
* @brief Parameter definitions for mapping peripherals directly to SAUL
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef SAUL_PERIPH_H
#define SAUL_PERIPH_H
#ifdef MODULE_SAUL_GPIO
#include "periph/gpio.h"
#endif /* MODULE_SAUL_GPIO */
#ifdef MODULE_SAUL_ADC
#include "periph/adc.h"
#endif /* MODULE_SAUL_ADC */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef MODULE_SAUL_GPIO
typedef enum {
SAUL_GPIO_INVERTED = (1 << 0), /**< pin is used as inverted */
SAUL_GPIO_INIT_CLEAR = (1 << 1), /**< set pin inactive after init */
SAUL_GPIO_INIT_SET = (1 << 2), /**< set pin active after init */
} saul_gpio_flags_t;
/**
* @brief Direct mapped GPIO configuration values
*/
typedef struct {
const char *name; /**< name of the device connected to this pin */
gpio_t pin; /**< GPIO pin to initialize and expose */
gpio_mode_t mode; /**< pin mode to use */
saul_gpio_flags_t flags; /**< Configuration flags */
} saul_gpio_params_t;
#endif /* MODULE_SAUL_GPIO */
#ifdef MODULE_SAUL_ADC
/**
* @brief Direct mapped ADC configuration values
*/
typedef struct {
const char *name; /**< name of the device connected to this pin */
adc_t line; /**< ADC line to initialize and expose */
adc_res_t res; /**< ADC resolution */
} saul_adc_params_t;
#endif /* MODULE_SAUL_ADC */
#ifdef __cplusplus
}
#endif
#endif /* SAUL_PERIPH_H */
/** @} */