Polling vs. interrupts
Software must repeatedly check
- brake pedal port
- how often?
- need to make sure not to forget to do so (use timer)
Use automatic detection capability of processor
- connect brake pedal to GPIO input capture
- interrupt on level change
- register interrupt handler for brakePedalHandler
- interrupt handler
- if brakePressed = truethen clear interrupt flag