-
Notifications
You must be signed in to change notification settings - Fork 1
Software design
The source code is split into libraries, which are available globally, and board-specific files with functionality required in only one location.
The following modules were compiled into archives and statically linked to the applications listed in the following section.
The microprocessor vendor makes these libraries available for high level access to system peripherals through function calls (rather than direct register access).
- Serial devices including the USB, CAN and USART necessary for this project.
- Timer control and PWM output.
- Analog IO (DAC and ADC).
- A debugging though the USART port.
- External memory drivers.
Several additional modules were added to the previous set.
- Actuator drivers for the Brake and Steering boards.
- A new CAN library to replace the substandard module supplied by Atmel.
- A protocol handling, message passing unit.
The source code for each board was responsible for initialising the required
peripherals and handling the four states prescribed by the State Machine.
A template version of a client board main file is available at
[Software/src/client/main.c
](https://github.com/team-ramrod/mariokart/blob/
master/Software/src/client/main.c). As shown, the entry-point
function calls the relevant *_init() methods and then moves into an infinite
loop containing a 'switch-case' state machine. Most state transitions are handled
by the protocol module which is shared between all boards; the only transition
a client board is responsible for is to error state in the case of a hardware error
being discovered. The source for the designated 'master' board can be found at
Software/src/comms/main.c
. The important difference between this and the
client boards is that the master board may drive all the state transitions through
the special interface it has to the
protocol module.