Difference between revisions of "KIR Vars.h"
From AnalysIR WiKi
(Created page with "'''''> KontroLIR Home > back''''' Here we provide some commentary about the variables/contan...")
Revision as of 07:01, 9 October 2019
Here we provide some commentary about the variables/contants defined in KIR_Vars.h Essentially, all non-local varaibles are defined here.
- rowPins/colPins - provides a mapping from row/col number (1-7) to Arduino pins. The index is zero based, such that Col1 is a offset 0.
- scanCode - is set in function isButtonPressed every time a button is pressed. It contains a unique code for each logical button made up from col/row number plus the Device Mode offset (altMode).
- altMode - This contains the offset for each mode. MODE1 is 0, MODE2 is 49, MODE3 is 93(49*2) etc. These values are preconfigured in KIR_header.h. The value is updated everytime a device mode is changed.
- col - contains the value of the last col (0-6 for col 1-7). Set in function isButtonPressed every time a button is pressed.
- row - contains the value of the last row (0-6 for row 1-7). Set in function isButtonPressed every time a button is pressed.
- toggleFlag - is used to manage signal toggling for subsequent presses of the same button, if the protocol uses toggling. We have demonstrated several uses of this toggle in some extensions to IRremote in file KIR_Infrared_Tx.ino (e.g. for RC5, RC6, MSRC6 etc). If you encounter another protocol using a toggle bit, you can use the same approach.
- pcIntCol - this is set by the PCINT ISR to indicate the col that caused the latest interrupt. This information is later used in isButtonPressed function to determine which Row was pressed, which then uniquely identifies the button on the remote.
- maxRepeats - thsi is essentially a table of values, one for each remote button and mode combination. One set of 49 values must be configured foe each mode defined (5 in the reference). As can be seen most values are zero, which means that if the button is kept pressed only one IR signal will be sent. If the value is not zero, the signal will be repeated up to that number of times, provided the button is kept pressed. This is a clever way of ensuring that only buttons that need a repeat are repeated and also serves to save battery life , if the remote is left down the side of a couch with pressure on the buttons.