JC42 compliant temperature sensor driver

JC42 compliant temperature sensor driver. More...

Detailed Description

Description

The connection between the MCU and jc42 compliant temperature sensors is based on a I2C-interface. There are multiple jc42 compliant temperature sensors available such as the mcp9804 and the MAX6604. This driver reads the temperature from these sensors. The sensors support a alarm wire, but this is not supported by this driver.

Files

file  jc42.h
 Driver for jc42 compliant temperature sensors.
 
file  jc42_internal.h
 Internal addresses, registers, constants for jc42 sensors.
 

Data Structures

struct  jc42_t
 Device descriptor for a jc42 device. More...
 
struct  jc42_params_t
 Device initialization parameters. More...
 

Functions

int jc42_init (jc42_t *dev, const jc42_params_t *params)
 Initialize a jc42 device. More...
 
int jc42_get_config (const jc42_t *dev, uint16_t *data)
 Get content of configuration register. More...
 
int jc42_set_config (const jc42_t *dev, uint16_t data)
 Set content of configuration register. More...
 
int jc42_get_temperature (const jc42_t *dev, int16_t *temperature)
 Get measured temperature. More...
 

Variables

const saul_driver_t jc42_temperature_saul_driver
 export SAUL endpoint
 

jc42 status return codes

#define JC42_OK   (0)
 
#define JC42_NOI2C   (-1)
 
#define JC42_NODEV   (-2)
 

Function Documentation

◆ jc42_get_config()

int jc42_get_config ( const jc42_t dev,
uint16_t *  data 
)
Parameters
[in]devdevice descriptor
[out]databuffer where config register will be written to
Returns
0 on success
-1 on error

◆ jc42_get_temperature()

int jc42_get_temperature ( const jc42_t dev,
int16_t *  temperature 
)
Parameters
[in]devdevice descriptor
[out]temperatureuint16_t buffer where temperature will be written to in centi-degree
Returns
0 on success
-1 on error

◆ jc42_init()

int jc42_init ( jc42_t dev,
const jc42_params_t params 
)
Parameters
[out]devdevice descriptor
[in]paramsjc42 initialization struct
Returns
0 on success
-1 on error

◆ jc42_set_config()

int jc42_set_config ( const jc42_t dev,
uint16_t  data 
)
Parameters
[in]devdevice descriptor
[in]datanew value for configuration register
Returns
0 on success
-1 on error