Loading...
Searching...
No Matches
JC42 compliant temperature sensor driver

JC42 compliant temperature sensor driver. More...

Detailed Description

JC42 compliant temperature sensor driver.

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.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

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

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.
 
int jc42_get_config (const jc42_t *dev, uint16_t *data)
 Get content of configuration register.
 
int jc42_set_config (const jc42_t *dev, uint16_t data)
 Set content of configuration register.
 
int jc42_get_temperature (const jc42_t *dev, int16_t *temperature)
 Get measured temperature.
 

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)
 

Macro Definition Documentation

◆ JC42_NODEV

#define JC42_NODEV   (-2)

Definition at line 49 of file jc42.h.

◆ JC42_NOI2C

#define JC42_NOI2C   (-1)

Definition at line 48 of file jc42.h.

◆ JC42_OK

#define JC42_OK   (0)

Definition at line 47 of file jc42.h.

Function Documentation

◆ jc42_get_config()

int jc42_get_config ( const jc42_t dev,
uint16_t *  data 
)

Get content of configuration register.

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 
)

Get measured 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 
)

Initialize a jc42 device.

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 
)

Set content of configuration register.

Parameters
[in]devdevice descriptor
[in]datanew value for configuration register
Returns
0 on success
-1 on error