Mini clavier pour XBMC
Aller à la navigation
Aller à la recherche
Projet réalisé par fma38.
Abandonné
Présentation
Il s'agit de développer un mini-clavier dédié pour contrôler quelques fonctions de base de XBMC, principalement celles en relation avec les divers players audio (CD, mp3, web radios...), afin d'éviter d'allumer l'écran principal. Un petit écran LCD est prévu pour compléter ce clavier.
Pour ça, on va utiliser un petit Teensy 2.0 en mode émulation clavier, avec quelques touches (max 20) connectées sur ses entrées.
Raccourcis claviers standards
Liste des raccourcis standards définis dans XBMC :
| Key | Global | Video playback | Music visualisation | Slide show |
|---|---|---|---|---|
| A | Audio offset | |||
| C | Contextual menu | |||
| F | Fast forward | Fast forward | Fast forward | |
| I | Info | Info | Info | |
| L | Next subtitle | Lock preset | ||
| M | Player controls (OSD) | Player controls (OSD) | Player controls (OSD) | |
| N | "Now playing" playlist | |||
| O | Displays CPU usage & video diagnostic info |
Codec info | Codec/Visualisation info | Info (EXIF data) |
| P | Play | Play | Visualisation preset list | Start slideshow |
| Q | Queue | |||
| R | Rewind | Rewind | Rewind | Rotate |
| S | Shutdown menu | Show preset | ||
| T | Toggle subtitles on and off | |||
| V | Visualisation settings | |||
| W | Marked as watched / unwatched | |||
| X | Stop | Stop | Stop | |
| Z | Zoom/aspect ratio | |||
| 0 | Zoom Normal (100%) | |||
| 1 | Zoom Level 1 | |||
| 2 | Zoom Level 2 | |||
| 3 | Zoom Level 3 | |||
| 4 | Zoom Level 4 | |||
| 5 | Zoom Level 5 | |||
| 6 | Zoom Level 6 | |||
| 7 | Zoom Level 7 | |||
| 8 | Zoom Level 8 | |||
| 9 | Zoom Level 9 | |||
| Space | Pause/Play | Pause/Play | Pause/Play | |
| Left | Left | Step back | Previous | Previous picture |
| Right | Right | Step forward | Next | Next picture |
| Up | Up | Big step forward | Increase rating | |
| Down | Down | Big step back | Decrease rating | |
| PageUp | Page up | |||
| PageDown | Page down | |||
| Enter | Select | Player controls (OSD) | Player controls (OSD) | |
| Backspace | Back | |||
| Esc | Previous menu | Exit full screen | ||
| . | Skip forward | Skip forward | Skip forward | Next picture |
| , | Skip backward | Skip backward | Skip backward | Previous picture |
| ' | Small step back (7sec) | |||
| Tab | Fullscreen mode | Fullscreen mode | Fullscreen mode | |
| PrintSrc | Screenshot | Screenshot | Screenshot | |
| - | Volume down | Volume down | Volume down | Zoom out |
| + | Volume up | Volume up | Volume up | Zoom in |
| = | Volume up | Volume up | Volume up | Zoom in |
| \ | Toggle application windowed mode | Toggle application windowed mode | Toggle application windowed mode | |
| [ | Big step forward, or next chapter | |||
| ] | Big step backward, or previous chapter | |||
| Shift+LETTER | Jump to that letter in a list |
Touches dédiées
Touches implémentées sur le mini clavier :
| Key | Global | Video playback | Music visualisation | Slide show | Mini clavier |
|---|---|---|---|---|---|
| C | Contextual menu | Menu (?) | |||
| F | Fast forward | Fast forward | Fast forward | >> | |
| I | Info | Info | Info | INFO | |
| M | Player controls (OSD) | Player controls (OSD) | Player controls (OSD) | Menu (?) | |
| N | Now playing playlist | ||||
| O | Displays CPU usage & video diagnostic info |
Codec info | Codec/Visualisation info | Info (EXIF data) | INFO |
| P | Play | Play | Visualisation preset list | Start slideshow | > |
| R | Rewind | Rewind | Rewind | Rotate | << |
| X | Stop | Stop | Stop | STOP | |
| Space | Pause/Play | Pause/Play | Pause/Play | > / I I | |
| Left | Left | Step back 10" | Previous | Previous picture | < |
| Right | Right | Step forward 10" | Next | Next picture | > |
| Up | Up | Big step forward 1' | Increase rating | ^ | |
| Down | Down | Big step back 1' | Decrease rating | v | |
| Enter | Select | Player controls (OSD) | Player controls (OSD) | OK | |
| Backspace | Back | BACK | |||
| Esc | Previous menu | Exit full screen | ESC | ||
| Tab | Fullscreen mode | Fullscreen mode | Fullscreen mode | FULL |
À voir :
- utilisation d'un potar incrémental (quelles touches mapper ?)
- touches custom (eject, mymusic, myvideo...) -> nécessite plugin ?
Hardware
Un simple Teensy 2.0 suffit ; il dispose de 25 I/O.
Firmware
Test (merci à Edgar pour la simplification du code) :
Cliquer sur le bouton à droite pour faire apparaître/disparaître le code...
// XBMC mini-keyboard and IR receiver
#include <Bounce.h>
#include <IRremote.h>
const uint8_t PIN_IR_RECV = 0;
const uint8_t PIN_LED = 11;
// A key is a debounced button with an associated keycode.
struct KbdKey : public Bounce
{
KbdKey(uint16_t code, uint8_t pin) : Bounce(pin, 10), keycode(code) {
pinMode(pin, INPUT_PULLUP);
}
uint8_t keycode;
};
// Create keys
KbdKey keys[] = {
KbdKey(KEY_UP, 1),
KbdKey(KEY_DOWN, 2),
KbdKey(KEY_LEFT, 3),
KbdKey(KEY_RIGHT, 4),
KbdKey(KEY_ENTER, 5), // Select/OSD
KbdKey(KEY_SPACE, 6), // Play/pause
KbdKey(KEY_ESC, 7), // Previous menu/exit fullscreen
KbdKey(KEY_BACKSPACE, 8), // Back in menus
KbdKey(KEY_TAB, 9), // Toggle fullscreen
KbdKey(KEY_PERIOD, 10), // Skip forward
KbdKey(KEY_COMMA, 12), // Skip backward
KbdKey(KEY_X, 13), // Stop
KbdKey(KEY_I, 14), // Info
KbdKey(KEY_C, 15) // Contextual menu
};
// Create IR receiver objects
IRrecv ir_recv(PIN_IR_RECV);
decode_results ir_results;
void setup() {
// Configure IR
ir_recv.enableIRIn(); // Start the receiver
ir_recv.blink13(false); // Disable blink led uppon receiving IR code
// Enable LED
pinMode(PIN_LED, OUTPUT);
}
void loop() {
// Check IR code
if (ir_recv.decode(&ir_results)) {
Keyboard.println(ir_results.decode_type);
Keyboard.println(ir_results.value);
// Visual feedback of known code
digitalWrite(PIN_LED, HIGH); // LED on
delay(10);
digitalWrite(PIN_LED, LOW); // LED off
ir_recv.resume();
}
// Check all the keys.
for (uint8_t i = 0; i < sizeof keys / sizeof *keys; i++) {
KbdKey *key = &keys[i];
// Update the button.
key->update();
// Press key on falling edge.
if (key->fallingEdge()) {
Keyboard.set_key1(key->keycode);
Keyboard.send_now();
}
// Release key on rising edge.
if (key->risingEdge()) {
Keyboard.set_key1(0);
Keyboard.send_now();
}
}
}