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
steering_cruise_control_stalk()
Operation
Uses an periodic reader to read voltages, and converts them to cruise control events.
adc_periodic_reader()
Code Block |
---|
adc_periodic_reader_init(storage, settings) {} * period adc_periodic_reader_set_up_channel(storage) {} adc_init(gpio_address, prv_) // initialize the adc * gpio_address * channel analog_reader_register_callback(callback, channel) {}reader_id,adc_settings)//sets up the channels //so an interrupt will be triggered periodically and will call the callback function adc_periodic_reader_start(reader_id) //starts the soft timer adc_periodic_reader_stop(reader_id) |
accepts a callback, repeatedly calls that callback with new data as it gets new data.
...
Event | Source | Destination | Data | Description |
---|---|---|---|---|
BUTTONSTEERING_DIGITAL_PRESSINPUT_EVENT_HORN | steering_digital_input | steering_can | 1: pressed 0: released | |
BUTTONSTEERING_DIGITAL_PRESSINPUT_EVENT_HIGH_BEAM_FORWARD | steering_digital_input | steering_can | 1: ON 0: OFF | |
BUTTONSTEERING_DIGITAL_PRESSINPUT_EVENT_HIGH_BEAM_REAR | steering_digital_input | steering_can | 1: ON 0: OFF | |
BUTTONSTEERING_DIGITAL_PRESSINPUT_EVENT_REGEN_BRAKE_TOGGLE | steering_digital_input | steering_can | none | |
BUTTONSTEERING_DIGITAL_PRESSINPUT_EVENT_CC_TOGGLE | steering_digital_input | steering_cannone, 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 | ||
Old Car GPIO INPUTS
Input | GPIO Address | Description |
---|---|---|
STEERING_DIGITAL_INPUT_HORN | PB1 | ???? |
STEERING_DIGITAL_INPUT_LANE_ASSIST | PA6 | GPIO top button |
STEERING_DIGITAL_INPUT_HIGH_BEAM_FORWARD | PA7 | GPIO pull above back |
STEERING_DIGITAL_INPUT_HIGH_BEAM_REAR | PB0 | GPIO push above forward |
STEERING_DIGITAL_INPUT_REGEN_BRAKE_TOGGLE | PA4 | GPIO bottom button |
STEERING_DIGITAL_INPUT_CC_ON_OFF | PA5 | GPIO pull bottom back |
STEERING_DIGITAL_DIGITAL_INPUT_CC_INCREASE_SPEED STEERING_DIGITAL_DIGITAL_INPUT_CC_DECREASE_SPEED | PA2 | ADC: pull bottom up/down |
nothing? | PA1 | ???? |
the distance thingy… | PA3 | This is an ADC |
sick | PA0 | this is an ADC |
...
Input | GPIO Address | Description |
---|---|---|
STEERING_DIGITAL_INPUT_HORN | PB1 | |
STEERING_DIGITAL_INPUT_LANE_ASSIST | PA6 | |
STEERING_DIGITAL_INPUT_HIGH_BEAM_FORWARD | PA7 | |
STEERING_DIGITAL_INPUT_HIGH_BEAM_REAR | PB0 | |
STEERING_DIGITAL_INPUT_REGEN_BRAKE_TOGGLE | PA4 | |
STEERING_DIGITAL_INPUT_CC_ON_OFF | PA5 | |
STEERING_DIGITAL_DIGITAL_INPUT_CC_INCREASE_SPEED | PA2 | |
STEERING_DIGITAL_DIGITAL_INPUT_CC_DECREASE_SPEED | PA1 | |
STEERING_DIGITAL_DIGITAL_INPUT_TURN_SIGNAL_STALK | PA3 | This is an ADC |
Outgoing CAN Messages
CAN Message | Exported Enums: | |
---|---|---|
CAN_TRANSMIT_LIGHTS_STATESm | u8 EELightType, u8 EELightState | |
CAN_TRANSMIT_HORN_STATE | u8 EEHornState | |
CAN_TRANSMIT_CRUISE_COMMAND | u8 cruise_command |
Other Concerns
cruise control being enabled at the startup
add a check at startup
cruise control pin being noisy
will probably debounce? or some thing like that…