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 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
47 #define JC42_OK (0)
48 #define JC42_NOI2C (-1)
49 #define JC42_NODEV (-2)
55 typedef struct {
57  uint8_t addr;
58 } jc42_t;
59 
63 typedef struct {
66  uint8_t addr;
68 
73 
84 int jc42_init(jc42_t* dev, const jc42_params_t* params);
85 
95 int jc42_get_config(const jc42_t* dev, uint16_t* data);
96 
106 int jc42_set_config(const jc42_t* dev, uint16_t data);
107 
117 int jc42_get_temperature(const jc42_t* dev, int16_t* temperature);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* JC42_H */
i2c_speed_t
Definition: periph_cpu.h:276
int jc42_get_config(const jc42_t *dev, uint16_t *data)
Get content of configuration register.
int jc42_init(jc42_t *dev, const jc42_params_t *params)
Initialize a jc42 device.
int jc42_get_temperature(const jc42_t *dev, int16_t *temperature)
Get measured temperature.
int jc42_set_config(const jc42_t *dev, uint16_t data)
Set content of configuration register.
const saul_driver_t jc42_temperature_saul_driver
Export SAUL endpoint.
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:145
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition: jc42.h:63
i2c_t i2c
I2C device that sensor is connected to.
Definition: jc42.h:64
uint8_t addr
Configured address of the sensor.
Definition: jc42.h:66
i2c_speed_t speed
I2C device speed.
Definition: jc42.h:65
Device descriptor for a jc42 device.
Definition: jc42.h:55
i2c_t i2c
I2C device that sensor is connected to.
Definition: jc42.h:56
uint8_t addr
I2C address of this particular sensor.
Definition: jc42.h:57
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:284
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.