...
Driver Inputs
IO Initialization
IO initialization has been split into To simplify device setup, two separate modules have been created to take care of IO initialization for both digital and analog devices.
Input Handling
Once an event has been generated, it will be stored inside a global event queue until it is time to process the event. The system will use FSM arbitration to events will be stored inside a global event queue until inputs. A configuration file has also been set up to define the addresses used for each device.
In addition, since the type of ISR needed to handle an input event will depend on whether the input is digital or analog, the responsibility for handling the events for particular device will fall onto either the digital or analog module, depending on the device.
Input Handling
Since input commands are to be made by the user, the events will be handled through the ISRs.
CAN Data Scheme
Until a sufficient protocol can be defined for sending driver input data over CAN, we will be using the following dummy scheme for the event data field:
Bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Contents | Device identifier | Device | ||||||||||||||
the
Pin Assignments
Input Device | Pin | Type |
---|---|---|
Power | PC0 | Digital |
Gas Pedal | PA1 | Analog |
Mechanical Brake | PA2 | Analog |
Direction Selector Forward |
PB2 | Digital |
Direction Selector Reverse | PB3 |
Digital | ||
Cruise Control | PC4 | Digital |
Cruise Control Increase | PC5 | Digital |
Cruise Control Decrease | PC6 | Digital |
Turn Signal Right | PC7 | Digital |
Turn Signal Left | PC8 | Digital |
Hazard Light Switch | PC9 |
Handling Inputs
The driver control inputs will be connected to onboard GPIOs. As we are only concerned with handling each input as they are triggered, most of the inputs will be set to be handled through the use of a common ISR. The ISR will then look at the debounced state of the triggering input device and raise the proper event in the event queue. The event queue will then be used to send the necessary messages over CAN and I2C.
...
Digital |
Finite State Machine
The program will be controlled through the use of multiple Finite State Machines to ensure that inputs are only serviced at the appropriate periods.
...