...
Functional Block Diagram:
Modules:
- lights_can:
- It's Its main responsibility is to solely receive can messages and raise events.
- Is the only module that knows about whether software is at the front board or the back board.
- The only occasion where it sends a can message is a sync signal to the other board.
- main: This module only contains a main loop where it gets the raised events from lights_can and passes them to the next three modules: strobe, simple_peripherals, and signals_fsm. Every module checks if it owns the event that is passed to it and processes it. If the event is not related to the module, the module ignores it.
- simple_peripherals: Used for all the peripherals which have a simple on, or off state. These peripherals are: horn, headlights, and brake lights.
- strobe: Uses a blinker object to blink the strobe light.
- signals_fsm: Contains the FSM of the signals. Every often calls send_sync from lights_can to sync the two boards. Uses blinker for blinking the signals.
- blinker: Basically handles all the overhead related to using soft timers.
- lights_gpio:
- Is the only module that knows about all the addresses.
- Can be thought of the only part where the boards actually take action?!
- strobe, signals_fsm, and simple_peripherals all call its lights_gpio_set() function to change the state of the lights.
...