Skip to content

Instantly share code, notes, and snippets.

@TiNredmc
Created March 20, 2022 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiNredmc/892e21663e6ab81c8198a0eb1a05055a to your computer and use it in GitHub Desktop.
Save TiNredmc/892e21663e6ab81c8198a0eb1a05055a to your computer and use it in GitHub Desktop.
Keyboard scanner using Arduino Mega 2560 to reverse engineer Blackberry Passport Keyboard.
/* 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