Difference between revisions of "Inputs as Key Matrix (ICX-AlphaCom)"
From Zenitel Wiki
(→On button press) |
(→On button release) |
||
Line 127: | Line 127: | ||
[[File:ICX_Matrix2.PNG|thumb|left|500px]] | [[File:ICX_Matrix2.PNG|thumb|left|500px]] | ||
<br style="clear:both;" /> | <br style="clear:both;" /> | ||
− | + | {{Code2| | |
− | IF %udd(%1.phy) | + | IF %udd(%1.phy) |
− | IF %op(%udd(%1.phy),=,1) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,1) |
− | !Virtual Input 1 | + | !Virtual Input 1 |
− | $DD L%1.DIR L101 | + | $DD L%1.DIR L101 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,2) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,2) |
− | !Virtual Input 2 | + | !Virtual Input 2 |
− | $DD L%1.DIR L102 | + | $DD L%1.DIR L102 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,3) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,3) |
− | !Virtual Input 3 | + | !Virtual Input 3 |
− | $DD L%1.DIR L103 | + | $DD L%1.DIR L103 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,4) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,4) |
− | !Virtual Input 4 | + | !Virtual Input 4 |
− | $DD L%1.DIR L104 | + | $DD L%1.DIR L104 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,5) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,5) |
− | !Virtual Input 5 | + | !Virtual Input 5 |
− | $DD L%1.DIR L105 | + | $DD L%1.DIR L105 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,6) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,6) |
− | !Virtual Input 6 | + | !Virtual Input 6 |
− | $DD L%1.DIR L106 | + | $DD L%1.DIR L106 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,7) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,7) |
− | !Virtual Input 7 | + | !Virtual Input 7 |
− | $DD L%1.DIR L107 | + | $DD L%1.DIR L107 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,8) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,8) |
− | !Virtual Input 8 | + | !Virtual Input 8 |
− | $DD L%1.DIR L108 | + | $DD L%1.DIR L108 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,9) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,9) |
− | !Virtual Input 9 | + | !Virtual Input 9 |
− | $DD L%1.DIR L109 | + | $DD L%1.DIR L109 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,10) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,10) |
− | !Virtual Input 10 | + | !Virtual Input 10 |
− | $DD L%1.DIR L110 | + | $DD L%1.DIR L110 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,11) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,11) |
− | !Virtual Input 11 | + | !Virtual Input 11 |
− | $DD L%1.DIR L111 | + | $DD L%1.DIR L111 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,12) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,12) |
− | !Virtual Input 12 | + | !Virtual Input 12 |
− | $DD L%1.DIR L112 | + | $DD L%1.DIR L112 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,13) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,13) |
− | !Virtual Input 13 | + | !Virtual Input 13 |
− | $DD L%1.DIR L113 | + | $DD L%1.DIR L113 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,14) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,14) |
− | !Virtual Input 14 | + | !Virtual Input 14 |
− | $DD L%1.DIR L114 | + | $DD L%1.DIR L114 |
− | ENDIF | + | ENDIF |
− | IF %op(%udd(%1.phy),=,15) | + | IF %op(%udd(%1.phy),<nowiki>=</nowiki>,15) |
− | !Virtual Input 15 | + | !Virtual Input 15 |
− | $DD L%1.DIR L115 | + | $DD L%1.DIR L115 |
− | ENDIF | + | ENDIF |
− | WUDD %1.phy 0 | + | WUDD %1.phy 0 |
− | ENDIF | + | ENDIF |
+ | }} |
Revision as of 10:15, 9 February 2023
Use Inputs As Key Matrix
If there is a need for more than the 6 inputs available, it is possible to combine inputs in a diode matrix and use the Event Handler to process. By for example using 3 physical inputs it is possible to get 7 virtual inputs.
The different options are:
- 2 Inputs (input 1-2, Virtual Inputs 1-3)
Input 2 | Input 1 | Virtual Input triggered |
0 | 1 | Virtual Input 1 |
1 | 0 | Virtual Input 2 |
1 | 1 | Virtual Input 3 |
0 | 0 | Inputs released |
- 3 Inputs (input 1-3, Virtual Inputs 1-7):
Input 3 | Input 2 | Input 1 | Virtual Input triggered |
0 | 0 | 1 | Virtual Input 1 |
0 | 1 | 0 | Virtual Input 2 |
0 | 1 | 1 | Virtual Input 3 |
1 | 0 | 0 | Virtual Input 4 |
1 | 0 | 1 | Virtual Input 5 |
1 | 1 | 0 | Virtual Input 6 |
1 | 1 | 1 | Virtual Input 7 |
0 | 0 | 0 | Inputs released |
- 4 Inputs (input 1-4, Virtual Input 1-15):
Input 4 | Input 3 | Input 2 | Input 1 | Virtual Input triggered |
0 | 0 | 0 | 1 | Virtual Input 1 |
0 | 0 | 1 | 0 | Virtual Input 2 |
0 | 0 | 1 | 1 | Virtual Input 3 |
0 | 1 | 0 | 0 | Virtual Input 4 |
0 | 1 | 0 | 1 | Virtual Input 5 |
0 | 1 | 1 | 0 | Virtual Input 6 |
0 | 1 | 1 | 1 | Virtual Input 7 |
1 | 0 | 0 | 0 | Virtual Input 8 |
1 | 0 | 0 | 1 | Virtual Input 9 |
1 | 0 | 1 | 0 | Virtual Input 10 |
1 | 0 | 1 | 1 | Virtual Input 11 |
1 | 1 | 0 | 0 | Virtual Input 12 |
1 | 1 | 0 | 1 | Virtual Input 13 |
1 | 1 | 1 | 0 | Virtual Input 14 |
1 | 1 | 1 | 1 | Virtual Input 15 |
0 | 0 | 0 | 0 | Inputs released |
The Virtual Input actions are configured from the Event Handler.
Events
2 events are required to process inputs as a matrix. Shown below are the events required for 15 inputs (2^4). You can expand this to 63 inputs (2^6) if required.
On button press
Here, we use the serial nature of the Event Handler to process the individual inputs.
By assigning a bitwise value to the input, we can add this value to a UDD associated with the physical number.
As each successive input is processed by the event handler, a total sum is derived.
Action commands:
IF %op(%sev(1),=,1) !Input 1 WUDD %1.PHY %op(%udd(%1.PHY),+,1) ENDIF IF %op(%sev(1),=,2) !Input 2 WUDD %1.PHY %op(%udd(%1.PHY),+,2) ENDIF IF %op(%sev(1),=,3) !Input 3 WUDD %1.PHY %op(%udd(%1.PHY),+,4) ENDIF IF %op(%sev(1),=,4) !Input 4 WUDD %1.PHY %op(%udd(%1.PHY),+,8) ENDIF
On button release
Here, we again rely on the serial processing of the input release.
First we check if the UDD has a value other than 0.
Then we check the value of the UDD and process the required command. This can be a $DD, $DIAL_DAK, $SM or any other DP command.
After the first round of processing, the UDD is returned to 0 so that successive input release commands do not execute.
Action commands:
IF %udd(%1.phy) IF %op(%udd(%1.phy),=,1) !Virtual Input 1 $DD L%1.DIR L101 ENDIF IF %op(%udd(%1.phy),=,2) !Virtual Input 2 $DD L%1.DIR L102 ENDIF IF %op(%udd(%1.phy),=,3) !Virtual Input 3 $DD L%1.DIR L103 ENDIF IF %op(%udd(%1.phy),=,4) !Virtual Input 4 $DD L%1.DIR L104 ENDIF IF %op(%udd(%1.phy),=,5) !Virtual Input 5 $DD L%1.DIR L105 ENDIF IF %op(%udd(%1.phy),=,6) !Virtual Input 6 $DD L%1.DIR L106 ENDIF IF %op(%udd(%1.phy),=,7) !Virtual Input 7 $DD L%1.DIR L107 ENDIF IF %op(%udd(%1.phy),=,8) !Virtual Input 8 $DD L%1.DIR L108 ENDIF IF %op(%udd(%1.phy),=,9) !Virtual Input 9 $DD L%1.DIR L109 ENDIF IF %op(%udd(%1.phy),=,10) !Virtual Input 10 $DD L%1.DIR L110 ENDIF IF %op(%udd(%1.phy),=,11) !Virtual Input 11 $DD L%1.DIR L111 ENDIF IF %op(%udd(%1.phy),=,12) !Virtual Input 12 $DD L%1.DIR L112 ENDIF IF %op(%udd(%1.phy),=,13) !Virtual Input 13 $DD L%1.DIR L113 ENDIF IF %op(%udd(%1.phy),=,14) !Virtual Input 14 $DD L%1.DIR L114 ENDIF IF %op(%udd(%1.phy),=,15) !Virtual Input 15 $DD L%1.DIR L115 ENDIF WUDD %1.phy 0 ENDIF