RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
temp_sensor.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2026 Efinix Inc. All rights reserved.
3// Full license header bsp/efinix/EfxSapphireSocRV64/include/LICENSE.MD
5
6#ifndef TEMP_SENSOR_H_
7#define TEMP_SENSOR_H_
8
19
20#include "i2c/i2c.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
69
70/* ========================================================================== */
71/* SUB-GROUP : Data Types */
72/* ========================================================================== */
73
80
86
87
99 // End of TEMP_SENSOR_ENUM group
102
103/* ========================================================================== */
104/* SUB-GROUP : DATA STRUCTS */
105/* ========================================================================== */
143
148 typedef struct {
151 float low_limit;
153
158 typedef struct {
159 temp_sensor_channelData_t channels[3]; // Supports up to 3 diodes
161
183
198 // End of TEMP_SENSOR_Types group
200
201
202/* ========================================================================== */
203/* SUB-GROUP: FUNCTIONS */
204/* ========================================================================== */
205
238 u8 tempSensor_writeTempReg(temp_sensor_instance_t *temp, const u8 reg, const u8 data);
247 u8 tempSensor_encodeTempLimit(float val, u8 is_extended, u8 *out_hb, u8 *out_lb);
255 float tempSensor_calTempCelsius(u8 hb, u8 lb, u8 is_extended); // End of TEMP_SENSOR_Funcs group
257
258
259
260/* ========================================================================== */
261/* SUB-GROUP: TEMP SENSOR CONFIGURATION */
262/* ========================================================================== */
263
266
267#ifdef __cplusplus
268
269}
270#endif //End of TEMP_SENSOR group
272
273#endif /* TEMP_SENSOR_H_ */
temp_sensor_status_t
Temperature Sensor Status List.
Definition temp_sensor.h:91
@ TEMP_SENSOR_USER_ERR
User provide wrong input *‍/.
Definition temp_sensor.h:94
@ TEMP_SENSOR_SKIP
Skip the function *‍/.
Definition temp_sensor.h:95
@ TEMP_SENSOR_HIGH_ALERT
High Temperature Alert *‍/.
Definition temp_sensor.h:96
@ TEMP_SENSOR_OK
Successful Operation *‍/.
Definition temp_sensor.h:92
@ TEMP_SENSOR_LOW_ALERT
Low Temperature Alert *‍/.
Definition temp_sensor.h:97
@ TEMP_SENSOR_ERR
Failed to retrieve/write value *‍/.
Definition temp_sensor.h:93
temp_sensor_status_t tempSensor_enableErrorInterrupt(temp_sensor_instance_t *temp)
Enable error interrupt for the Temperature Sensor.
Definition temp_sensor.c:31
temp_sensor_status_t tempSensor_applyConfig(temp_sensor_instance_t *temp)
Apply I2C + Temp Sensor configuration.
Definition temp_sensor.c:21
u8 tempSensor_readTempReg(temp_sensor_instance_t *temp, const u8 reg)
Read a register from the Temperature Sensor.
Definition temp_sensor.c:39
u8 tempSensor_writeTempReg(temp_sensor_instance_t *temp, const u8 reg, const u8 data)
Write a value to a register in the Temperature Sensor.
Definition temp_sensor.c:49
u8 tempSensor_encodeTempLimit(float val, u8 is_extended, u8 *out_hb, u8 *out_lb)
Encode temperature limit into high and low byte format.
Definition temp_sensor.c:72
float tempSensor_calTempCelsius(u8 hb, u8 lb, u8 is_extended)
Calculate temperature in Celsius from high and low byte format.
Definition temp_sensor.c:59
struct temp_sensor_instance temp_sensor_instance_t
Forward declaration of Temperature Sensor instance.
I2C driver API definitions.
I2C instance. Holds the software registers and hardware pointer.
Definition i2c.h:290
Temperature Sensor API structure.
temp_sensor_status_t(* checkTempAlert)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* applyConfig)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* enableErrorInterrupt)(temp_sensor_instance_t *temp)
u8(* checkTempRange)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* getTemp)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* setTempRange)(temp_sensor_instance_t *temp, u8 enable_extended)
temp_sensor_status_t(* getTempLimit)(temp_sensor_instance_t *temp)
temp_sensor_status_t(* setTempLimit)(temp_sensor_instance_t *temp)
Hold temperature data for a single channel/diode.
float high_limit
High Temperature Limit *‍/.
float current_temp
Current Temperature *‍/.
float low_limit
Low Temperature Limit *‍/.
Temperature Sensor data structure.
temp_sensor_channelData_t channels[3]
Temperature Sensor instance structure.
const temp_sensor_api_t * drv
Pointer to Temperature Sensor API structure *‍/.
temp_sensor_data_t temp_value
Temperature Sensor data *‍/.
i2c_instance_t * inst
Pointer to I2C instance *‍/.
Temperature Sensor Configuration and Driver Selection.
uint8_t u8
Definition type.h:30