io1_xplained.h
2.7 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright (C) 2016 Inria
*
* 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.
*/
/**
* @defgroup drivers_io1_xplained IO1_XPLAINED
* @ingroup drivers_sensors
* @brief Device driver interface for the IO1 Xplained extension.
* @{
*
* @file
* @brief Device driver interface for the IO1 Xplained extention.
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef IO1_XPLAINED_H_
#define IO1_XPLAINED_H_
#include "saul.h"
#include "at30tse75x.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Device descriptor for the IO1 Xplained extension.
*/
typedef struct {
at30tse75x_t temp /**< On-board temperature sensor */;
} io1_xplained_t;
/**
* @brief Device initialization parameters
*/
typedef struct {
uint8_t addr; /**< extension custom address */
} io1_xplained_params_t;
/**
* @brief export SAUL endpoints
* @{
*/
extern const saul_driver_t io1_xplained_temperature_saul_driver;
/** @} */
/**
* @brief auto-initialize all configured IO1 Xplained extensions
*/
void io1_xplained_auto_init(void);
/**
* @brief Initialize the given IO1 Xplained extension
*
* @param[out] dev Initialized device descriptor of IO1 Xplained extension
* @param[in] addr Custom address of the extension board
*
* @return 0 on success
* @return -1 if given I2C is not enabled in board config
*/
int io1_xplained_init(io1_xplained_t *dev, uint8_t addr);
/**
* @brief Read temperature value from the given IO1 Xplained extension, returned in °C
*
* @param[in] dev Device descriptor of IO1 Xplained to read from
* @param[out] temperature Temperature in °C
*
* @return 0 on success
* @return -1 if device's I2C is not enabled in board config
*/
int io1_xplained_read_temperature(io1_xplained_t *dev, float *temperature);
/**
* @brief Set the on-board led of the IO1 Xplained extension
*
* @return 0 on success
* @return -1 if extension GPIO is not enabled in board config
*/
int io1_xplained_set_led(void);
/**
* @brief Clear the on-board led of the IO1 Xplained extension
*
* @return 0 on success
* @return -1 if extension GPIO is not enabled in board config
*/
int io1_xplained_clear_led(void);
/**
* @brief Toggle the on-board led of the IO1 Xplained extension
*
* @return 0 on success
* @return -1 if extension GPIO is not enabled in board config
*/
int io1_xplained_toggle_led(void);
#ifdef __cplusplus
}
#endif
#endif /* IO1_XPLAINED_H_ */
/** @} */