Modules
Modules for this board:
steering_can
Methods:
...
Overview
The main goal of the Steering Interface is to detect steering events such as when the horn is pressed or the turn signal is moved. Once it detects this, it will raise an event and send a CAN message.
For digital input, this is accomplished by:
Initializing all the pins with an interrupt in steering_digital_input
Triggering the interrupt if a certain button is pressed (eg horn) which raises an event
Processing the event and sending the respective CAN message in steering_can
For analog input, this is accomplished by:
Using adc_periodic_reader which uses soft_timer and interrupts to periodically check the voltage
Checking the voltages and raising the correct event using steering_control_stalk
Processing the event and sending the respective CAN message in steering_can
Modules
Modules for this board:
steering_can
Code Block |
---|
steering_can_process_event() //Sends CAN messages |
steering_digital_input()
Code Block | ||
---|---|---|
| ||
steering_digital_input_init() // sets up interrupts for buttons and generates events |
...
processes events and sends steering CAN messages.
steering_
...
control_stalk()
Code Block |
---|
signalcontrol_stalk_init(configuration) // sets up analog_readers configuration = { } signal_stalk |
Operation
Uses an analog reader to read voltages, and converts them to signal events
...
adc_
...
periodic_
...
Operation
...
reader()
Code Block |
---|
steeringadc_cruiseperiodic_controlreader_stalk_init() steering adc_cruiseperiodic_controlreader_stalkset_processup_event() // for brake pressed events |
adc_periodic_reader()
Code Block |
---|
adc_periodic_reader_init(storage, settings) {} * periodchannel(reader_id,adc_settings)//sets up the channels //so an interrupt will be triggered periodically and will call the callback function adc_periodic_reader_set_up_channel(storage) {} adc_init(gpio_address, prv_start(reader_id) //starts initialize the adcsoft timer * gpio_address * channel analogadc_periodic_reader_register_callback(callback, channelstop(reader_id) {} |
accepts a callback, repeatedly calls that callback with new data as it gets new data.
adc_periodic_storage_global
...
Events
Event | Source | Destination | Data | Description |
---|---|---|---|---|
STEERING_DIGITAL_INPUT_EVENT_HORN | steering_digital_input | steering_can | 1: pressed 0: released | |
STEERING_DIGITAL_INPUT_EVENT_HIGH_BEAM_FORWARD | steering_digital_input | steering_can | 1: ON 0: OFF | |
STEERING_DIGITAL_INPUT_EVENT_HIGH_BEAM_REAR | steering_digital_input | steering_can | 1: ON 0: OFF | |
STEERING_DIGITAL_INPUT_EVENT_REGEN_BRAKE_TOGGLE | steering_digital_input | steering_can | none | |
STEERING_DIGITAL_INPUT_EVENT_CC | steering_digital_input | steering_can, cruise_control_stalk | 1: ON 0: OFF | |
STEERING_SIGNAL_STALK_EVENT_LEFT | signal_stalk | steering_can | none | |
STEERING_SIGNAL_STALK_EVENT_RIGHT | signal_stalk | steering_can | none | |
STEERING_SIGNAL_STALK_EVENT_OFF | signal_stalk | steering_can | none | |
STEERING_CRUISE_CONTROL_EVENT_INCREASE_SPEED | cruise_control_stalk | steering_can | none | |
STEERING_CRUISE_CONTROL_EVENT_DECREASE_SPEED | cruise_control_stalk | steering_can | none | |
STEERING_CRUISE_CONTROL_EVENT_BRAKE_PRESSED | steering_can | cruise_control_stalk | ||
...