Loading...
Searching...
No Matches
jc42.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Koen Zandberg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
31
32#include "periph/i2c.h"
33#include "saul.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
43#define JC42_OK (0)
44#define JC42_NOI2C (-1)
45#define JC42_NODEV (-2)
47
51typedef struct {
53 uint8_t addr;
54} jc42_t;
55
59typedef struct {
62 uint8_t addr;
64
69
80int jc42_init(jc42_t* dev, const jc42_params_t* params);
81
91int jc42_get_config(const jc42_t* dev, uint16_t* data);
92
102int jc42_set_config(const jc42_t* dev, uint16_t data);
103
113int jc42_get_temperature(const jc42_t* dev, int16_t* temperature);
114
115#ifdef __cplusplus
116}
117#endif
118
i2c_speed_t
Definition periph_cpu.h:272
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
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:155
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition jc42.h:59
i2c_t i2c
I2C device that sensor is connected to.
Definition jc42.h:60
uint8_t addr
Configured address of the sensor.
Definition jc42.h:62
i2c_speed_t speed
I2C device speed.
Definition jc42.h:61
Device descriptor for a jc42 device.
Definition jc42.h:51
i2c_t i2c
I2C device that sensor is connected to.
Definition jc42.h:52
uint8_t addr
I2C address of this particular sensor.
Definition jc42.h:53
Definition of the RIOT actuator/sensor interface.
Definition saul.h:286