jc42.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Koen Zandberg
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 
33 #ifndef JC42_H
34 #define JC42_H
35 
36 #include "periph/i2c.h"
37 #include "saul.h"
38 
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
48 #define JC42_OK (0)
49 #define JC42_NOI2C (-1)
50 #define JC42_NODEV (-2)
51 
57 typedef struct {
59  uint8_t addr;
60 } jc42_t;
61 
65 typedef struct {
68  uint8_t addr;
70 
75 
86 int jc42_init(jc42_t* dev, const jc42_params_t* params);
87 
97 int jc42_get_config(const jc42_t* dev, uint16_t* data);
98 
108 int jc42_set_config(const jc42_t* dev, uint16_t data);
109 
110 
120 int jc42_get_temperature(const jc42_t* dev, int16_t* temperature);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* JC42_H */
127 
i2c_t i2c
I2C device that sensor is connected to.
Definition: jc42.h:66
int jc42_get_config(const jc42_t *dev, uint16_t *data)
Get content of configuration register.
i2c_t i2c
I2C device that sensor is connected to.
Definition: jc42.h:58
uint8_t addr
I2C address of this particular sensor.
Definition: jc42.h:59
i2c_speed_t speed
I2C device speed.
Definition: jc42.h:67
int jc42_init(jc42_t *dev, const jc42_params_t *params)
Initialize a jc42 device.
const saul_driver_t jc42_temperature_saul_driver
Export SAUL endpoint.
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:157
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:148
int jc42_get_temperature(const jc42_t *dev, int16_t *temperature)
Get measured temperature.
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
Device descriptor for a jc42 device.
Definition: jc42.h:57
int jc42_set_config(const jc42_t *dev, uint16_t data)
Set content of configuration register.
uint8_t addr
Configured address of the sensor.
Definition: jc42.h:68
Device initialization parameters.
Definition: jc42.h:65
Low-level I2C peripheral driver interface definition.