Temperature Gauge
This module provides functionality to manage and process temperature values, including temperature conversion, LED bar updates, and temperature state monitoring.
Configuration Parameters
All API functions have the first argument as the module ID.
Name |
Description |
Range |
---|---|---|
enable |
Enables the temperature module. |
0 (disabled) or 1 (enabled) |
max_temp |
Maximum temperature threshold for the system. |
0 to 255 (degrees Celsius) |
min_temp |
Minimum temperature threshold for the system. |
-40 to 0 (degrees Celsius) |
bar_count |
Number of temperature bars to display. |
1 to 7 bars |
temp_hysteresis |
Hysteresis applied to temperature bars to avoid rapid toggling. |
Integer value. |
temp_bar_threshold |
Threshold for turning bars on. |
Integer value (percentage or temperature). |
temp_idle_bar_threshold |
Threshold for activating idle bars. |
Integer value (configurable). |
temp_red_bar_threshold |
Threshold for activating red warning bars. |
Integer value (configurable). |
APIs
The Temperature module provides the following APIs to initialize, process, and update the temperature system:
Function |
Description |
---|---|
rs_am_temperature_init |
Initializes the temperature system with default configuration values. |
rs_am_temperature_process |
Processes the temperature module by converting raw values, updating the LED bar display, and managing state. |
Error Codes
Each API for the temperature module returns success or failure codes. For detailed information on the error codes, please refer to the following section:
See also
Temperature Module Header Details
The header file for the temperature module, rs_am_temperature.h, defines the required structures and APIs for initialization and processing.
Typedefs
-
typedef struct tag_rs_temp_config rs_temp_config_t
Temperature configuration data structure.
-
typedef struct tag_rs_temp_runtime rs_temp_runtime_t
Temperature runtime data structure.
-
typedef struct tag_rs_temp_output rs_temp_output_t
Temperature output data structure.
-
typedef struct tag_rs_am_temperature rs_am_temperature_t
Contains information about temperature.
Functions
-
rs_ret_val_t rs_am_temperature_init(rs_am_temperature_t *ptr_temperature)
Initializes the temperature module with default settings.
Configures initial values, registers events, and prepares the module for operation.
- Parameters:
ptr_temperature – [in] Pointer to the temperature structure to be initialized.
- Returns:
Returns success after initialization.
-
rs_ret_val_t rs_am_temperature_process(rs_am_temperature_t *ptr_temperature)
Main processing function for the temperature module.
Performs temperature conversion, updates bar levels, and dispatches updated values.
- Parameters:
ptr_temperature – [in] Pointer to the temperature structure containing runtime data.
- Returns:
Returns success after processing the temperature data.
-
struct tag_rs_temp_config
- #include <rs_am_temperature.h>
Temperature configuration data structure.
Public Members
-
uint8_t enable
Enable/disable flag for the module.
-
uint8_t max_temp
Maximum temperature threshold.
-
uint8_t min_temp
Minimum temperature threshold.
-
uint8_t bar_count
Number of temperature bars.
-
uint8_t temp_hysteresis
Temperature bars hysteresis.
-
uint8_t temp_bar_threshold
Threshold for turning bars on.
-
uint8_t temp_idle_bar_threshold
Threshold for turning idle bars on.
-
uint8_t temp_red_bar_threshold
Threshold for turning red bars on.
-
uint8_t enable
-
struct tag_rs_temp_runtime
- #include <rs_am_temperature.h>
Temperature runtime data structure.
-
struct tag_rs_temp_output
- #include <rs_am_temperature.h>
Temperature output data structure.
Public Members
-
int16_t calculated_temp
Calculated temperature value.
-
uint8_t ramped_temp
Smoothed (ramped) temperature value.
-
uint8_t prev_display_temp
Previously displayed temperature bar.
-
int16_t display_temp_bar
Current displayed temperature value.
-
uint8_t filtered_temp
Filtered temperature for stability.
-
uint8_t temp_state
Fault state of the temperature sensor.
-
int16_t calculated_temp
-
struct tag_rs_am_temperature
- #include <rs_am_temperature.h>
Contains information about temperature.
Public Members
-
rs_temp_config_t config
Configuration structure.
-
rs_temp_runtime_t runtime
Runtime structure.
-
rs_temp_output_t output
Output structure.
-
rs_temp_config_t config