Tachometer
This module provides a set of functionalities for managing the Tachometer system, including initialization, RPM calculations, RPM averaging, and configuration management to ensure accurate representation of engine RPM.
Configuration Parameters
All API functions have the first argument as the module ID.
Name |
Description |
Range |
---|---|---|
enable |
Enables Tachometer functionality. |
0 (disabled) or 1 (enabled) |
rpm_range |
The RPM range for the tachometer. |
Minimum to Maximum RPM (e.g., 0 to 8000) |
bar_count |
The number of bars for RPM display. |
1 to 16 |
rpm_thresholds |
RPM thresholds for bar activation. |
Array of thresholds (configurable values). |
average_period |
The number of data points used for calculating average RPM. |
1 to 100 |
APIs
The Tachometer module provides the following APIs to initialize, process, and update the tachometer data:
Function |
Description |
---|---|
rs_am_tachometer_init |
Initializes the tachometer system with default configuration values. |
rs_am_tachometer_process |
Processes the tachometer system by calculating the RPM and updating bar states. |
Error Codes
Each API for the tachometer module returns success or failure codes. For detailed information on the error codes, please refer to the following section:
See also
Tachometer Module Header Details
The header file for tachometer modules, rs_am_tachometer.h, defines the required structures and APIs for initialization and processing.
Typedefs
-
typedef struct tag_rs_tacho_config rs_tacho_config_t
Includes.
Tachometer runtime data structure
-
typedef struct tag_rs_tacho_runtime rs_tacho_runtime_t
Tachometer configuration data structure.
-
typedef struct tag_rs_tacho_output rs_tacho_output_t
Tachometer output data structure.
-
typedef struct tag_rs_am_tachometer rs_am_tachometer_t
Contains information about tachometer.
Functions
-
rs_ret_val_t rs_am_tachometer_init(rs_am_tachometer_t *ptr_tachometer)
Initializes the tachometer module with default configuration.
Sets up initial configuration values for the tachometer, including bar thresholds and hysteresis for RPM transitions.
- Parameters:
ptr_tachometer – [in] Pointer to the Tachometer structure to initialize.
- Returns:
Returns success after initialization.
-
rs_ret_val_t rs_am_tachometer_process(rs_am_tachometer_t *ptr_tachometer)
Main processing function for the tachometer module.
Calculates average RPM, updates bar levels, and processes dispatcher events.
- Parameters:
ptr_tachometer – [in] Pointer to the Tachometer structure for processing.
- Returns:
Returns success after processing the tachometer data.
-
struct tag_rs_tacho_config
- #include <rs_am_tachometer.h>
Includes.
Tachometer runtime data structure
Public Members
-
uint8_t enable_module
Enable/Disable tachometer module.
-
uint16_t max_tacho_val
Maximum tachometer value.
-
uint16_t tacho_hysteresis
Hysteresis value only for tachometer off.
-
uint8_t max_bar_count
Maximum bar count for tachometer display.
-
uint16_t tacho_bar_threshold
Values for bars that should be turned on and off.
-
uint16_t tacho_idle_bar_threshold
idle Value for bars that should be turned on and off
-
uint16_t tacho_red_bar_threshold
Max or over RPM Values for bars that should be turned on and off.
-
uint8_t enable_module
-
struct tag_rs_tacho_runtime
- #include <rs_am_tachometer.h>
Tachometer configuration data structure.
-
struct tag_rs_tacho_output
- #include <rs_am_tachometer.h>
Tachometer output data structure.
-
struct tag_rs_am_tachometer
- #include <rs_am_tachometer.h>
Contains information about tachometer.
Public Members
-
rs_tacho_config_t config
Configuration for tachometer.
-
rs_tacho_runtime_t runtime
Runtime state of the tachometer.
-
rs_tacho_output_t output
Output values of the tachometer.
-
rs_tacho_config_t config