JC42 compliant temperature sensor driver

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.

JC42_OK
1
(0)
JC42_NOI2C
1
(-1)
JC42_NODEV
1
(-2)
const saul_driver_t jc42_temperature_saul_driver

Export SAUL endpoint.

int jc42_init(jc42_t * dev, const jc42_params_t * params)

Initialize a jc42 device.

Parameters

dev:device descriptor
params:jc42 initialization struct

Return values

  • 0 on success
  • -1 on error
int jc42_get_config(const jc42_t * dev, uint16_t * data)

Get content of configuration register.

Parameters

dev:device descriptor
data:buffer where config register will be written to

Return values

  • 0 on success
  • -1 on error
int jc42_set_config(const jc42_t * dev, uint16_t data)

Set content of configuration register.

Parameters

dev:device descriptor
data:new value for configuration register

Return values

  • 0 on success
  • -1 on error
int jc42_get_temperature(const jc42_t * dev, int16_t * temperature)

Get measured temperature.

Parameters

dev:device descriptor
temperature:uint16_t buffer where temperature will be written to in centi-degree

Return values

  • 0 on success
  • -1 on error
struct jc42_t

Device descriptor for a jc42 device.

i2c.h::i2c_t i2c

I2C device that sensor is connected to.

uint8_t addr

I2C address of this particular sensor.

struct jc42_params_t

Device initialization parameters.

i2c.h::i2c_t i2c

I2C device that sensor is connected to.

cc2538/include/periph_cpu.h::i2c_speed_t speed

I2C device speed.

uint8_t addr

Configured address of the sensor.