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.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

  • addr: Device I2C address

  • port: I2C port

  • sda_gpio: SDA GPIO

  • scl_gpio: SCL GPIO

esp_err_t tsys01_free_desc(tsys01_t *dev)

Free device descriptor.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

esp_err_t tsys01_init(tsys01_t *dev)

Initialize device.

Reads sensor configuration.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

esp_err_t tsys01_reset(tsys01_t *dev)

Reset sensor.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

esp_err_t tsys01_start(tsys01_t *dev)

Start temperature conversion.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

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

Read converted temperature from sensor.

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

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

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

esp_err_t tsys01_measure(tsys01_t *dev, float *t)

Perform temperature convertion.

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

Return

ESP_OK on success

Parameters
  • dev: Device descriptor

  • [out] t: Temperature, degrees Celsius

struct tsys01_t
#include <tsys01.h>

Device descriptor.