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 
31 #ifndef JC42_H
32 #define JC42_H
33 
34 #include "periph/i2c.h"
35 #include "saul.h"
36 
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
46 #define JC42_OK (0)
47 #define JC42_NOI2C (-1)
48 #define JC42_NODEV (-2)
49 
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 
108 
118 int jc42_get_temperature(const jc42_t* dev, int16_t* temperature);
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
125 #endif /* JC42_H */
i2c_t i2c
I2C device that sensor is connected to.
Definition: jc42.h:64
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:56
uint8_t addr
I2C address of this particular sensor.
Definition: jc42.h:57
i2c_speed_t speed
I2C device speed.
Definition: jc42.h:65
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:113
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:140
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:55
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:66
Device initialization parameters.
Definition: jc42.h:63
Low-level I2C peripheral driver interface definition.