Ne voulant pas avoir un clavier à manipuler, même un tout petit, j'ai cherché et trouvé un moyen de le remplacer par un compatible arduino et un clavier matriciel maison de 4×6 touches.
Voici les fonctions assignées au clavier
La liste des raccourcis clavier de Kodi se trouvent sur la page Keyboard controls.
Je me suis ensuite inspiré de l'exemple de HID Keyboard de Sparkfun pour créer mon clavier
#include <Key.h> #include <Keypad.h> #include <Keyboard.h> #include <HID.h> const byte ROWS = 6; //six rows const byte COLS = 4; //for columns char keys[ROWS][COLS] = { {'1', '2', '3', '4'}, {'5', '6', '7', '8'}, {'9', '0', 'A', 'B'}, {'C', 'D', 'E', 'F'}, {'G', 'H', 'I', 'J'}, {'K', 'L', 'M', 'N'} }; byte rowPins[ROWS] = {9, 8, 7, 6, 5, 4}; //connect to the row pinouts of the keypad byte colPins[COLS] = {15, 14, 16, 10}; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup(){ } void loop(){ char key = keypad.getKey(); switch(key){ case '1': Keyboard.write(KEY_DOWN_ARROW); break; // Prev Track case '5': Keyboard.write('R'); break; // Rewind case '9': Keyboard.write(' '); break; // Pause/Play case 'C': Keyboard.write('X'); break; // Stop case 'G': Keyboard.write('F'); break; // Fast forward case 'K': Keyboard.write(KEY_UP_ARROW); break; // Next track case '4': Keyboard.press(223); Keyboard.release(223); break; // Volume + case '2': Keyboard.press(222); Keyboard.release(222); break; // Volume - case '8': Keyboard.write(KEY_ESC); break; // Home case '6': Keyboard.write(KEY_TAB); break; // Full Screen case 'E': Keyboard.write(KEY_LEFT_ARROW); break; // "Left" case 'H': Keyboard.write(KEY_DOWN_ARROW); break; // "Down" case 'I': Keyboard.write(KEY_RETURN); break; // Select case 'J': Keyboard.write(KEY_UP_ARROW); break; // "Up" case 'M': Keyboard.write(KEY_RIGHT_ARROW); break; // "Right" } }
Pour envoyer le sketch dans le Pro Micro, il faut suivre les instructions de la page Reset to Bootloader : Monter un bouton reset entre les pin “RST” et “GND”, presser 2x dessus et là il faut être très rapide: on a 8 secondes pour uploader le code..
Voici un dessin du veroboard avec l’implantation des composants:
Un second veroboard avec le Sparkfun Pro Micro est monté au dos du clavier: