Loading...
Searching...
No Matches
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
9#pragma once
10
34
35#include "periph/i2c.h"
36#include "saul.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
46#define JC42_OK (0)
47#define JC42_NOI2C (-1)
48#define JC42_NODEV (-2)
50
54typedef struct {
56 uint8_t addr;
57} jc42_t;
58
62typedef struct {
65 uint8_t addr;
67
72
83int jc42_init(jc42_t* dev, const jc42_params_t* params);
84
94int jc42_get_config(const jc42_t* dev, uint16_t* data);
95
105int jc42_set_config(const jc42_t* dev, uint16_t data);
106
116int jc42_get_temperature(const jc42_t* dev, int16_t* temperature);
117
118#ifdef __cplusplus
119}
120#endif
121
i2c_speed_t
Definition periph_cpu.h:275
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:144
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition jc42.h:62
i2c_t i2c
I2C device that sensor is connected to.
Definition jc42.h:63
uint8_t addr
Configured address of the sensor.
Definition jc42.h:65
i2c_speed_t speed
I2C device speed.
Definition jc42.h:64
Device descriptor for a jc42 device.
Definition jc42.h:54
i2c_t i2c
I2C device that sensor is connected to.
Definition jc42.h:55
uint8_t addr
I2C address of this particular sensor.
Definition jc42.h:56
Definition of the RIOT actuator/sensor interface.
Definition saul.h:283