Created
March 20, 2022 07:11
-
-
Save TiNredmc/892e21663e6ab81c8198a0eb1a05055a to your computer and use it in GitHub Desktop.
Keyboard scanner using Arduino Mega 2560 to reverse engineer Blackberry Passport Keyboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Key scanner to reverse engineer Blackberry Passport keyboard pinout. | |
* Coded By TinLethax (Can't remember the date, probably 2022/03/17). | |
*/ | |
// https://tinlethax.wordpress.com/2022/03/20/reverse-engineering-blackberry-passport-keyboard-pinout-part-2/ | |
// using Arduino Mega's pin 22 to 38 | |
// I updated the Conversion array (from arduino pin to actual connector pin). | |
// I sacrificed the keyboard (by taking it apart and bought a new one). | |
// to probe and get ~70% done with some left to probe with new kerboard (to replace the first one I took apart). | |
uint8_t toffcpin[16]={ | |
2, 3, 4, 5, 6, 7, | |
17, 18, 19, 20, 21, 22, | |
24, 25, 26, 27};// actual pinout of the connector. | |
void setup() { | |
// put your setup code here, to run once: | |
for (int i = 0; i < 16; i++) { | |
pinMode(i + 22, INPUT_PULLUP); | |
} | |
Serial.begin(9600); | |
Serial.println("Starting Keyboard scanner"); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
for (int i = 0; i < 16; i++) { | |
for (int j = 0; j < 16; j++) { | |
if ( j != i) { | |
pinMode(j + 22, OUTPUT); | |
digitalWrite(j + 22, LOW); | |
//delay(5); | |
if (!digitalRead(i + 22)) { | |
Serial.print("found:"); | |
Serial.print(toffcpin[i]); | |
Serial.print(","); | |
Serial.println(toffcpin[j]); | |
} | |
pinMode(j + 22, INPUT_PULLUP);// set back to default as input pin | |
} else | |
pinMode(j + 22, INPUT_PULLUP); | |
delay(5); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment