This document describes all the components of the software and how they relate to one another.
The components consist of Functions and Global variables, which the functions will use
Used for configuration, and overall program flow handling
Used: None
Uses:
- Led Configurator
- Timer Configurator
- Button Handler
- Standard and Rush mode handler
- Night mode handler
- Traffic mode
- Ticks
- Next Ticks
Sets up the pins to output, makes button pins interrupt-aware
Used: Main Function
Uses: None
Sets up timer to tick every 0.25 of a second, repeatedly
Used: Main Function
Uses: None
Handles button presses
Used: Main Function
Uses:
- Main Pedestrian Flag
- Side Pedestrian Flag
- Car Sensor Flag
- Traffic Mode
- Light State
- Ticks
- Next Tick
Checks the flags, which are raised by button presses. Instructs lights handler to change lights for standard and rush modes.
Used: Main Function
Uses:
- Main Lights handler
- Side Lights handler
- Main Pedestrian Flag
- Side Pedestrian Flag
- Car Sensor flag
- Motion flag
- Light State
- Next Tick
Checks the flags, which are raised by button presses. Instructs lights handler to change lights for night mode.
Used: Main Function
Uses:
- Night Mode Handler
- Main Pedestrian Flag
- Side Pedestrian Flag
- Light State
- Next Tick
Changes Lights for the main car and pedestrian road.
Used: Standard and Rush mode handler
Uses: Light State
Changes Lights for the side car and pedestrian road.
Used: Standard and Rush mode handler
Uses: Light State
Changes all Lights, for night mode only.
Used: Night Mode Handler
Uses: Light State
Global variables cannot use other components
Raised by main road pedestrian button press.
Used:
- Button Handler
- Standard and Rush Mode Handler
- Night Mode Handler
Raised by side road pedestrian button press.
Used:
- Button Handler
- Standard and Rush Mode Handler
- Night Mode Handler
Raised by car sensor being active.
Used:
- Button Handler
- Standard and Rush Mode Handler
Used as a "wait" for Pedestrian button presses, so pedestrians could not repeatedly press and abuse the buttons.
Used:
- Button Handler
- Standard and Rush Mode Handler
Indicates which traffic mode it is:
- -1 - Stopped mode
- 0 - Standard mode
- 1 - Rush mode
- 2 - Night mode
Used:
- Main Function
- Button Handler
Indicates which light state it is, as described in Requirements RE5
Used:
- Button Handler
- Standard and Rush Mode Handler
- Night Mode Handler
- Main Lights Handler
- Side Lights Handler
- Night Lights Handler
Used to count current time (in 0.25 of second).
Used:
- Main Function
- Button Handler
Used to indicate when the next action (light change) should happen (in 0.25 of second).
Used:
- Main Function
- Button Handler
- Standard and Rush Mode Handler
- Night Mode Handler