Here’s the reference video that was used in today’s class about interrupts. Go through it, it is quite informative.
There is one assignment for this session, to simulate a tachometer by pressing a button instead of the DOUT from the IR sensor.
- Print the number of times the button on the Bluey board is pressed in say every 5 seconds.
- This can be done by configuring a GPIOTE channel in Event mode, selecting BUTTON1 as the PSEL, LoToHi as the polarity (reference: config registers in page 162 of datasheet).
- Enabling interrupt for EVENTS_IN of GPIOTE.
- Enabling and setting priority for the GPIOTE peripheral in the NVIC
- Writing the counter task_count in the interrupt routine.
- Next, instead of enabling interrupt of GPIOTE and writing its interrupt routine, one can use the PPI to send the event from GPIOTE on button press to the task_count of the counting timer.
If anyone is feeling adventurous, please go ahead with building an actual tachometer as demonstrated today.
Do get in touch with us if you want us to review your code anytime. Cheers!