ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
TMP117 Interface

Implement rd_sensor_t functions on TMP117. More...

Files

file  ruuvi_interface_tmp117.c
 
file  ruuvi_interface_tmp117.h
 

Macros

#define TMP117_CC_RETRIES_MAX   (5U)
 
#define TMP117_CC_RETRY_DELAY_MS   (10U)
 
#define TMP117_REG_TEMP_RESULT   (0x00U)
 
#define TMP117_REG_CONFIGURATION   (0x01U)
 
#define TMP117_REG_THIGH_LIMIT   (0x02U)
 
#define TMP117_REG_TLOW_LIMIT   (0x03U)
 
#define TMP117_REG_EEPROM_UL   (0x04U)
 
#define TMP117_REG_EEPROM1   (0x05U)
 
#define TMP117_REG_EEPROM2   (0x06U)
 
#define TMP117_REG_TEMP_OFFSET   (0x07U)
 
#define TMP117_REG_EEPROM3   (0x08U)
 
#define TMP117_REG_DEVICE_ID   (0x0FU)
 
#define TMP117_MASK_RESET   (0x0002U)
 
#define TMP117_MASK_ID   (0x01FFU)
 
#define TMP117_MASK_OS   (0x0060U)
 
#define TMP117_MASK_MODE   (0x0C00U)
 
#define TMP117_MASK_CC   (0x0380U)
 
#define TMP117_VALUE_ID   (0x0117U)
 
#define TMP117_POS_OS   (5U)
 
#define TMP117_VALUE_OS_1   (0x00U << TMP117_POS_OS)
 
#define TMP117_VALUE_OS_8   (0x01U << TMP117_POS_OS)
 
#define TMP117_VALUE_OS_32   (0x02U << TMP117_POS_OS)
 
#define TMP117_VALUE_OS_64   (0x03U << TMP117_POS_OS)
 
#define TMP117_POS_CC   (7U)
 
#define TMP117_VALUE_CC_16_MS   (0x00U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_125_MS   (0x01U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_250_MS   (0x02U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_500_MS   (0x03U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_1000_MS   (0x04U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_4000_MS   (0x05U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_8000_MS   (0x06U << TMP117_POS_CC)
 
#define TMP117_VALUE_CC_16000_MS   (0x07U << TMP117_POS_CC)
 
#define TMP117_POS_MODE   (10U)
 
#define TMP117_VALUE_MODE_SLEEP   (0x01U << TMP117_POS_MODE)
 
#define TMP117_VALUE_MODE_SINGLE   (0x03U << TMP117_POS_MODE)
 
#define TMP117_VALUE_MODE_CONT   (0x00U << TMP117_POS_MODE)
 
#define TMP117_POS_DRDY   (13U)
 
#define TMP117_MASK_DRDY   (1U << TMP117_POS_DRDY)
 
#define TMP117_VALUE_TEMP_NA   (0x8000U)
 
#define TMP117_OS_1_TSAMPLE_MS   (16U)
 
#define TMP117_OS_8_TSAMPLE_MS   (125U)
 
#define TMP117_OS_32_TSAMPLE_MS   (500U)
 
#define TMP117_OS_64_TSAMPLE_MS   (1000U)
 
#define TMP117_CC_RESET_DELAY_MS   (4U)
 

Functions

rd_status_t ri_tmp117_init (rd_sensor_t *environmental_sensor, rd_bus_t bus, uint8_t handle)
 rd_sensor_init_fp More...
 
rd_status_t ri_tmp117_uninit (rd_sensor_t *environmental_sensor, rd_bus_t bus, uint8_t handle)
 rd_sensor_init_fp More...
 
rd_status_t ri_tmp117_samplerate_set (uint8_t *samplerate)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_samplerate_get (uint8_t *samplerate)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_resolution_set (uint8_t *resolution)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_resolution_get (uint8_t *resolution)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_scale_set (uint8_t *scale)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_scale_get (uint8_t *scale)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_dsp_set (uint8_t *dsp, uint8_t *parameter)
 rd_sensor_dsp_fp More...
 
rd_status_t ri_tmp117_dsp_get (uint8_t *dsp, uint8_t *parameter)
 rd_sensor_dsp_fp More...
 
rd_status_t ri_tmp117_mode_set (uint8_t *mode)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_mode_get (uint8_t *mode)
 rd_sensor_setup_fp More...
 
rd_status_t ri_tmp117_data_get (rd_sensor_data_t *const data)
 rd_sensor_data_fp More...
 

Detailed Description

Implement rd_sensor_t functions on TMP117.

The implementation supports taking single-samples and a continuous mode

Macro Definition Documentation

◆ TMP117_CC_RESET_DELAY_MS

#define TMP117_CC_RESET_DELAY_MS   (4U)

Definition at line 95 of file ruuvi_interface_tmp117.h.

◆ TMP117_CC_RETRIES_MAX

#define TMP117_CC_RETRIES_MAX   (5U)

Definition at line 28 of file ruuvi_interface_tmp117.c.

◆ TMP117_CC_RETRY_DELAY_MS

#define TMP117_CC_RETRY_DELAY_MS   (10U)

Definition at line 29 of file ruuvi_interface_tmp117.c.

◆ TMP117_MASK_CC

#define TMP117_MASK_CC   (0x0380U)

Definition at line 60 of file ruuvi_interface_tmp117.h.

◆ TMP117_MASK_DRDY

#define TMP117_MASK_DRDY   (1U << TMP117_POS_DRDY)

Definition at line 86 of file ruuvi_interface_tmp117.h.

◆ TMP117_MASK_ID

#define TMP117_MASK_ID   (0x01FFU)

Definition at line 57 of file ruuvi_interface_tmp117.h.

◆ TMP117_MASK_MODE

#define TMP117_MASK_MODE   (0x0C00U)

Definition at line 59 of file ruuvi_interface_tmp117.h.

◆ TMP117_MASK_OS

#define TMP117_MASK_OS   (0x0060U)

Definition at line 58 of file ruuvi_interface_tmp117.h.

◆ TMP117_MASK_RESET

#define TMP117_MASK_RESET   (0x0002U)

Definition at line 56 of file ruuvi_interface_tmp117.h.

◆ TMP117_OS_1_TSAMPLE_MS

#define TMP117_OS_1_TSAMPLE_MS   (16U)

Definition at line 89 of file ruuvi_interface_tmp117.h.

◆ TMP117_OS_32_TSAMPLE_MS

#define TMP117_OS_32_TSAMPLE_MS   (500U)

Definition at line 91 of file ruuvi_interface_tmp117.h.

◆ TMP117_OS_64_TSAMPLE_MS

#define TMP117_OS_64_TSAMPLE_MS   (1000U)

Definition at line 92 of file ruuvi_interface_tmp117.h.

◆ TMP117_OS_8_TSAMPLE_MS

#define TMP117_OS_8_TSAMPLE_MS   (125U)

Definition at line 90 of file ruuvi_interface_tmp117.h.

◆ TMP117_POS_CC

#define TMP117_POS_CC   (7U)

Definition at line 70 of file ruuvi_interface_tmp117.h.

◆ TMP117_POS_DRDY

#define TMP117_POS_DRDY   (13U)

Definition at line 85 of file ruuvi_interface_tmp117.h.

◆ TMP117_POS_MODE

#define TMP117_POS_MODE   (10U)

Definition at line 80 of file ruuvi_interface_tmp117.h.

◆ TMP117_POS_OS

#define TMP117_POS_OS   (5U)

Definition at line 64 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_CONFIGURATION

#define TMP117_REG_CONFIGURATION   (0x01U)

Definition at line 46 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_DEVICE_ID

#define TMP117_REG_DEVICE_ID   (0x0FU)

Definition at line 54 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_EEPROM1

#define TMP117_REG_EEPROM1   (0x05U)

Definition at line 50 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_EEPROM2

#define TMP117_REG_EEPROM2   (0x06U)

Definition at line 51 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_EEPROM3

#define TMP117_REG_EEPROM3   (0x08U)

Definition at line 53 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_EEPROM_UL

#define TMP117_REG_EEPROM_UL   (0x04U)

Definition at line 49 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_TEMP_OFFSET

#define TMP117_REG_TEMP_OFFSET   (0x07U)

Definition at line 52 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_TEMP_RESULT

#define TMP117_REG_TEMP_RESULT   (0x00U)

Definition at line 45 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_THIGH_LIMIT

#define TMP117_REG_THIGH_LIMIT   (0x02U)

Definition at line 47 of file ruuvi_interface_tmp117.h.

◆ TMP117_REG_TLOW_LIMIT

#define TMP117_REG_TLOW_LIMIT   (0x03U)

Definition at line 48 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_1000_MS

#define TMP117_VALUE_CC_1000_MS   (0x04U << TMP117_POS_CC)

Definition at line 75 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_125_MS

#define TMP117_VALUE_CC_125_MS   (0x01U << TMP117_POS_CC)

Definition at line 72 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_16000_MS

#define TMP117_VALUE_CC_16000_MS   (0x07U << TMP117_POS_CC)

Definition at line 78 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_16_MS

#define TMP117_VALUE_CC_16_MS   (0x00U << TMP117_POS_CC)

Definition at line 71 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_250_MS

#define TMP117_VALUE_CC_250_MS   (0x02U << TMP117_POS_CC)

Definition at line 73 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_4000_MS

#define TMP117_VALUE_CC_4000_MS   (0x05U << TMP117_POS_CC)

Definition at line 76 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_500_MS

#define TMP117_VALUE_CC_500_MS   (0x03U << TMP117_POS_CC)

Definition at line 74 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_CC_8000_MS

#define TMP117_VALUE_CC_8000_MS   (0x06U << TMP117_POS_CC)

Definition at line 77 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_ID

#define TMP117_VALUE_ID   (0x0117U)

Definition at line 62 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_MODE_CONT

#define TMP117_VALUE_MODE_CONT   (0x00U << TMP117_POS_MODE)

Definition at line 83 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_MODE_SINGLE

#define TMP117_VALUE_MODE_SINGLE   (0x03U << TMP117_POS_MODE)

Definition at line 82 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_MODE_SLEEP

#define TMP117_VALUE_MODE_SLEEP   (0x01U << TMP117_POS_MODE)

Definition at line 81 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_OS_1

#define TMP117_VALUE_OS_1   (0x00U << TMP117_POS_OS)

Definition at line 65 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_OS_32

#define TMP117_VALUE_OS_32   (0x02U << TMP117_POS_OS)

Definition at line 67 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_OS_64

#define TMP117_VALUE_OS_64   (0x03U << TMP117_POS_OS)

Definition at line 68 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_OS_8

#define TMP117_VALUE_OS_8   (0x01U << TMP117_POS_OS)

Definition at line 66 of file ruuvi_interface_tmp117.h.

◆ TMP117_VALUE_TEMP_NA

#define TMP117_VALUE_TEMP_NA   (0x8000U)

Definition at line 88 of file ruuvi_interface_tmp117.h.

Function Documentation

◆ ri_tmp117_data_get()

rd_status_t ri_tmp117_data_get ( rd_sensor_data_t *const  data)

rd_sensor_data_fp

Definition at line 823 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_dsp_get()

rd_status_t ri_tmp117_dsp_get ( uint8_t *  dsp,
uint8_t *  parameter 
)

rd_sensor_dsp_fp

Definition at line 653 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_dsp_set()

rd_status_t ri_tmp117_dsp_set ( uint8_t *  dsp,
uint8_t *  parameter 
)

rd_sensor_dsp_fp

Definition at line 583 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_init()

rd_status_t ri_tmp117_init ( rd_sensor_t environmental_sensor,
rd_bus_t  bus,
uint8_t  handle 
)

rd_sensor_init_fp

< default OS setting

Definition at line 299 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_mode_get()

rd_status_t ri_tmp117_mode_get ( uint8_t *  mode)

rd_sensor_setup_fp

Definition at line 803 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_mode_set()

rd_status_t ri_tmp117_mode_set ( uint8_t *  mode)

rd_sensor_setup_fp

Definition at line 768 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_resolution_get()

rd_status_t ri_tmp117_resolution_get ( uint8_t *  resolution)

rd_sensor_setup_fp

Definition at line 527 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_resolution_set()

rd_status_t ri_tmp117_resolution_set ( uint8_t *  resolution)

rd_sensor_setup_fp

Definition at line 503 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_samplerate_get()

rd_status_t ri_tmp117_samplerate_get ( uint8_t *  samplerate)

rd_sensor_setup_fp

Definition at line 446 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_samplerate_set()

rd_status_t ri_tmp117_samplerate_set ( uint8_t *  samplerate)

rd_sensor_setup_fp

Definition at line 381 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_scale_get()

rd_status_t ri_tmp117_scale_get ( uint8_t *  scale)

rd_sensor_setup_fp

Definition at line 567 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_scale_set()

rd_status_t ri_tmp117_scale_set ( uint8_t *  scale)

rd_sensor_setup_fp

Definition at line 543 of file ruuvi_interface_tmp117.c.

◆ ri_tmp117_uninit()

rd_status_t ri_tmp117_uninit ( rd_sensor_t sensor,
rd_bus_t  bus,
uint8_t  handle 
)

rd_sensor_init_fp

Definition at line 357 of file ruuvi_interface_tmp117.c.