Gear Indication

This module provides a set of functionalities for managing the gear system, including determining the current gear state and handling gear mode transitions. It supports various gear modes such as Manual Transmission (MT), Automatic Transmission (AT), Automated Manual Transmission (AMT), and Dual-Clutch Transmission (DCT).

Configuration Parameters

All API functions have the first argument as the module ID.

Configuration

Name

Description

Range

enable

Enables gear functionality.

0 (disabled) or 1 (enabled)

transmission_type

Gear mode selection (e.g., MT, AT, AMT, DCT).

1 (MT), 2 (AT), 3 (AMT), 4 (DCT)

APIs

The Gear module provides the following APIs to initialize, process, and update gear state:

API Functions

Function

Description

rs_am_gear_init

Initializes the gear system with default configuration values and registers with the dispatcher.

rs_am_gear_process

Processes the gear system by checking gear conditions and updating the display based on the current gear.

Error Codes

Each API for the gear module returns success or failure codes. For detailed information on the error codes, please refer to the following section:

See also

:doc:/error_codes

Gear Module Header Details

The header file for the gear module, rs_am_gear_indication.h, defines the required structures and APIs for initialization and processing.

Typedefs

typedef struct tag_gear_config rs_gear_config_t

Includes.

Configuration structure for the gear module

typedef struct tag_gear_runtime rs_gear_runtime_t

Runtime structure for the gear module.

typedef struct tag_gear_output rs_gear_output_t

Output structure for the gear module.

typedef struct tag_rs_am_gear rs_am_gear_t

Full gear module structure that integrates config, runtime, and output.

Functions

rs_ret_val_t rs_am_gear_init(rs_am_gear_t *ptr_gear)

Initializes the gear module.

Registers the gear module with the dispatcher and sets initial states.

Parameters:

ptr_gear[in] Pointer to the gear structure.

Returns:

Returns success on successful initialization.

rs_ret_val_t rs_am_gear_process(rs_am_gear_t *ptr_gear)

Processes gear state and updates output.

Consumes dispatcher messages, checks conditions, and updates display.

Parameters:

ptr_gear[in] Pointer to the gear structure.

Returns:

Returns success after processing the gear state.

struct tag_gear_config
#include <rs_am_gear_indication.h>

Includes.

Configuration structure for the gear module

Public Members

uint8_t enable

Gear system enable/disable flag (0 = disable, 1 = enable)

uint8_t transmission_type

transmission type of operation (e.g., automatic, manual, park, etc.)

struct tag_gear_runtime
#include <rs_am_gear_indication.h>

Runtime structure for the gear module.

Public Members

uint8_t current_gear

The currently active gear (0 = neutral, 1 = 1st gear, etc.)

uint8_t target_gear

The target gear to shift to.

struct tag_gear_output
#include <rs_am_gear_indication.h>

Output structure for the gear module.

Public Members

uint8_t disp_gear

Display gear position.

uint8_t reserved[3]

Reserved for future extension.

struct tag_rs_am_gear
#include <rs_am_gear_indication.h>

Full gear module structure that integrates config, runtime, and output.

Public Members

rs_gear_config_t config

Configuration of the gear module.

rs_gear_runtime_t runtime

Runtime status of the gear module.

rs_gear_output_t output

Output information from the gear module.