tsys01 - Driver for precision digital temperature sensor TSYS01

group tsys01

ESP-IDF driver for digital temperature sensor TSYS01.

Copyright (C) 2020 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Defines

TSYS01_I2C_ADDR1
TSYS01_I2C_ADDR2

Functions

esp_err_t tsys01_init_desc(tsys01_t *dev, uint8_t addr, i2c_port_t port, gpio_num_t sda_gpio, gpio_num_t scl_gpio)

Initialize device descriptor.

Parameters
  • dev – Device descriptor

  • addr – Device I2C address

  • port – I2C port

  • sda_gpio – SDA GPIO

  • scl_gpio – SCL GPIO

Returns

ESP_OK on success

esp_err_t tsys01_free_desc(tsys01_t *dev)

Free device descriptor.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t tsys01_init(tsys01_t *dev)

Initialize device.

Reads sensor configuration.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t tsys01_reset(tsys01_t *dev)

Reset sensor.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t tsys01_start(tsys01_t *dev)

Start temperature conversion.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t tsys01_get_temp(tsys01_t *dev, uint32_t *raw, float *t)

Read converted temperature from sensor.

Parameters
  • dev – Device descriptor

  • [out] raw – Raw ADC value, NULL-able

  • [out] t – Temperature, degrees Celsius, NULL-able

Returns

ESP_OK on success

esp_err_t tsys01_measure(tsys01_t *dev, float *t)

Perform temperature conversion.

This function starts temperature conversion, waits 10 ms and reads result.

Parameters
  • dev – Device descriptor

  • [out] t – Temperature, degrees Celsius

Returns

ESP_OK on success

struct tsys01_t
#include <tsys01.h>

Device descriptor.