Added check for full slots
This commit is contained in:
parent
f8d5a66480
commit
592ca828ae
1 changed files with 11 additions and 5 deletions
|
@ -9,19 +9,20 @@
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
// This software controls a Lenovo ThinkPad T61 Laptop Keyboard and PS/2 Trackpoint using a Teensy 3.2 on
|
||||
// This software controls a Lenovo ThinkPad T61 Laptop Keyboard and PS/2 Trackpoint using a Teensy LC on
|
||||
// a daughterboard with a 44 pin FPC connector. The keyboard part number is 42T3177.
|
||||
// This routine uses the Teensyduino "Micro-Manager Method" to send Normal and Modifier
|
||||
// keys over USB. Only the volume control multi-media keys are supported by this routine.
|
||||
// Description of Teensyduino keyboard functions is at www.pjrc.com/teensy/td_keyboard.html
|
||||
// The ps/2 code uses the USB PJRC Mouse functions at www.pjrc.com/teensy/td_mouse.html
|
||||
// The ps/2 code has a watchdog timer so the code can't hang if a clock edge is missed.
|
||||
// In the Arduino IDE, select Tools, Teensy 3.2. Also under Tools, select Keyboard+Mouse+Joystick
|
||||
// In the Arduino IDE, select Tools, Teensy LC. Also under Tools, select Keyboard+Mouse+Joystick
|
||||
//
|
||||
// Revision History
|
||||
// Rev 1.0 - Nov 23, 2018 - Original Release
|
||||
// Rev 1.1 - Dec 2, 2018 - Replaced ps/2 trackpoint code from playground arduino with my own code
|
||||
// Rev 1.2 - May 27, 2019 - Changed comment that mistakenly refered to a Teensy LC (should say 3.2)
|
||||
// Rev 1.2 - July 16, 2019 - Check if slots are full when detecting a key press
|
||||
//
|
||||
// Trackpoint signals
|
||||
#define TP_DATA 18 // ps/2 data to trackpoint
|
||||
#define TP_CLK 19 // ps/2 clock to trackpoint
|
||||
|
@ -461,7 +462,12 @@ void clear_slot(int key) {
|
|||
else if (slot6 == key) {
|
||||
slot6 = 0;
|
||||
}
|
||||
slots_full = LOW;
|
||||
if (!slot1 || !slot2 || !slot3 || !slot4 || !slot5 || !slot6) {
|
||||
slots_full = LOW; // slots are not full
|
||||
}
|
||||
else {
|
||||
slots_full = HIGH; // slots are full
|
||||
}
|
||||
}
|
||||
//
|
||||
// Function to load the modifier key name into the appropriate mod variable
|
||||
|
@ -614,7 +620,7 @@ void loop() {
|
|||
//
|
||||
// ***********Normal keys section
|
||||
else if (normal[x][y] != 0) { // check if normal key exists at this location in the array (a non-zero value)
|
||||
if (!digitalRead(Col_IO[y]) && (old_key[x][y])) { // check if key is pressed and was not previously pressed
|
||||
if (!digitalRead(Col_IO[y]) && (old_key[x][y]) && (!slots_full)) { // check if key pressed and not previously pressed and slots not full
|
||||
old_key[x][y] = LOW; // Save state of key as "pressed"
|
||||
if ((normal[x][y] == KEY_SCROLL_LOCK) && (!Fn_pressed)) { // check for special case of Num Lock Key
|
||||
load_slot(KEY_NUM_LOCK); // update first available slot with Num Lock instead of Scroll Lock
|
||||
|
|
Loading…
Reference in a new issue