KIR Interrupts.ino: Difference between revisions

From AnalysIR WiKi
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
This file contains a number of functions for handling interrupts and related items.
This file contains a number of functions for handling interrupts and related items.


* ''KIR_initPCINT'' - this function initialises the MCU to handle the required PIINTs on the COL pins only. Col pins are set to INPUT_PULLUP and when a button is pressed the COL pin is pulled low, by the respective ROW pin. The resulting interrupt wakes the MCU up from sleep.
* ''KIR_initPCINT'' - this function initialises the MCU to handle the required PCINTs on the COL pins only. Col pins are set to INPUT_PULLUP and when a button is pressed the COL pin is pulled low, by the respective ROW pin. The resulting interrupt wakes the MCU up from sleep.
* ''KIR_enablePCint'' - this function clears any PCINT flags and enables interrupts for the COL pins.
* ''KIR_enablePCint'' - this function clears any PCINT flags and enables interrupts for the COL pins.
* ''KIR_disablePCint'' - this function clears any PCINT flags and disables interrupts for the COL pins. However, we do not use/call this function and simply disable PCINT every time withing the PCINT ISRs.
* ''KIR_disablePCint'' - this function clears any PCINT flags and disables interrupts for the COL pins. However, we do not use/call this function and simply disable PCINT every time directly within the PCINT ISRs.
* PCINT ISRs - We need to use 2 PCINT ISR vectors to handle interrupts rom the 7 COL pins. Here we record the COL number(1-7), Clear the PCINT flags anddisable further PCINT interrupts for now.
* PCINT ISRs - We need to use 2 PCINT ISR vectors to handle interrupts from the 7 COL pins. Here we record the COL number(1-7) which will be detected in the Main loop, Clear the PCINT flags. Once the new COL value is detected in the Main Loop, PCINT interrupts will be disabled until the MCU is sent to sleep again.
* WDT_ISR - not used, but as a precaution we simply disable WDT interrupts if ever called.
* WDT_ISR - not used, but as a precaution we simply disable WDT interrupts if ever called.
''Note: Only the PCINT1 & PCINT3 Interrupts are required to cover the 7 Col pins. PCINT0 & PCINT2 are not used.''





Latest revision as of 05:23, 16 January 2020

> KontroLIR Home > back

This file contains a number of functions for handling interrupts and related items.

  • KIR_initPCINT - this function initialises the MCU to handle the required PCINTs on the COL pins only. Col pins are set to INPUT_PULLUP and when a button is pressed the COL pin is pulled low, by the respective ROW pin. The resulting interrupt wakes the MCU up from sleep.
  • KIR_enablePCint - this function clears any PCINT flags and enables interrupts for the COL pins.
  • KIR_disablePCint - this function clears any PCINT flags and disables interrupts for the COL pins. However, we do not use/call this function and simply disable PCINT every time directly within the PCINT ISRs.
  • PCINT ISRs - We need to use 2 PCINT ISR vectors to handle interrupts from the 7 COL pins. Here we record the COL number(1-7) which will be detected in the Main loop, Clear the PCINT flags. Once the new COL value is detected in the Main Loop, PCINT interrupts will be disabled until the MCU is sent to sleep again.
  • WDT_ISR - not used, but as a precaution we simply disable WDT interrupts if ever called.

Note: Only the PCINT1 & PCINT3 Interrupts are required to cover the 7 Col pins. PCINT0 & PCINT2 are not used.



> KontroLIR Home > back