Temperature Sensor driver.
This module provides Generic functions to configure and control Temperature Sensor input/output and interrupt behavior.
Usage & Initialization.
This is an example show how to instantiate Temperature Sensor Driver with temp_sensor_instance_t.
This implementation depends on I2C Driver.
#define I2C_CTRL_HZ SYSTEM_CLINT_HZ
#define I2C_CTRL (i2c_hwreg_t *)SYSTEM_I2C_0_IO_CTRL
#define I2C_FREQ 100000
#define ACTIVE_TEMP_SENSOR_TYPE SENSOR_TYPE_EMC1413
.hwreg = I2C_CTRL,
.samplingClockDivider = 3,
.timeout = I2C_CTRL_HZ/1000,
.tsuDat = I2C_CTRL_HZ/(I2C_FREQ*5),
.tLow = I2C_CTRL_HZ/(I2C_FREQ*2),
.tHigh = I2C_CTRL_HZ/(I2C_FREQ*2),
.tBuf = I2C_CTRL_HZ/(I2C_FREQ),
},
};
#define TEMP_SENSOR_CTRL
I2C Address for the currently selected RTC (PCF8523).
#define TEMP_SENSOR_DRIVER
struct temp_sensor_instance temp_sensor_instance_t
Forward declaration of Temperature Sensor instance.
I2C instance. Holds the software registers and hardware pointer.
temp_sensor_status_t(* applyConfig)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* enableErrorInterrupt)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* getTemp)(temp_sensor_instance_t *temp)
float current_temp
Current Temperature */.
temp_sensor_channelData_t channels[3]
const temp_sensor_api_t * drv
Pointer to Temperature Sensor API structure */.
temp_sensor_data_t temp_value
Temperature Sensor data */.
Temperature Sensor driver API definitions.
- See also
- Supported Devices - Learn about the supported Temperature Sensor list.
-
Example Temperature Sensor Demo - Learn how to use the driver for Temperature Sensor operations