Skip to content

Commit

Permalink
Add exemple + add new special key
Browse files Browse the repository at this point in the history
  • Loading branch information
Robotechnic committed Jan 12, 2022
1 parent d03f0be commit 0bc6a21
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 126 deletions.
28 changes: 24 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,29 @@ For this library I was use this image wich come from [this](https://digistump.co
![KeyCodes](https://scriptel.com/KeyboardEmulationAPI/JavaScript/images/keyboard-identifiers.png)
You can also find every **HID** codes [here](http://www.freebsddiary.org/APC/usb_hid_usages.php).

## New spetial key
## Spetial key
/!\ Volume key sems to works only on some board with no explanations

| Consant |Key |
| :-------: |:---: |
| KEY_ARROW_RIGHT | Arrow right |
| KEY_ARROW_UP | Arrow up |
| KEY_ARROW_DOWN | Arrow down |
| KEY_CAPSLOCK | Caps Lock |
| KEY_NUMLOCK | Numpad Lock |
| KEY_ESC | Escape |
| KEY_ARROW_LEFT | Arrow left |
| KEY_DELETE | Delete key (delete forward) |
| KEY_BACKSPACE | backspace key (delete backward) |
| KEY_CAPSLOCK | Capslock key |
| KEY_NUMLOCK | Numlock key |
| KEY_PRINT_SCREEN | Print screen key |
| KEY_INSERT | insert key |
| KEY_END | go to end key |
| KEY_MUTE | volume mute key |
| KEY_VOLUME_UP | volume up key |
| KEY_VOLUME_DOWN | volume down key |
| KEY_COPY | copy to clipboard key |
| KEY_PASTE | paste from clipboard key |
| KEY_CUT | cut to clipboard key |
| KEY_ESC | Escape key |
| KEY_FR_A | AZERTY lower case key a |
| KEY_FR_B | AZERTY lower case key b |
| KEY_FR_C | AZERTY lower case key c |
Expand Down Expand Up @@ -54,6 +68,12 @@ You can also find every **HID** codes [here](http://www.freebsddiary.org/APC/usb
| KEY_FR_9 | AZERTY key 9 |

## Releases:
### Release 1.0.1:
* Add more exemples
* Add more special key
- KEY_BACKSPACE
- KEY_DELETE


### Release 1.0.0:
* The same functions that the original library (write, sendKeyStroke...)
Expand Down
47 changes: 47 additions & 0 deletions examples/sentences/sentences.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "DigiKeyboardFr.h"

// some rendom sentences
char* sentences[9] = {
"Hello world!",
"Bonjour le monde!",
"Hola mundo!",
"It is a beautiful day!",
"C'est un jour magnifique!",
"Estas un dia hermoso!",
"How are you?",
"Comment allez-vous?",
"Como estas?"
};

void setup() {
DigiKeyboardFr.delay(5000); //wait for cmputer to recognize keyboard
}

void loop() {
DigiKeyboardFr.print("Let's write some sentences!");
DigiKeyboardFr.delay(2000);
for (int i = 0; i < 27; i++) {
DigiKeyboardFr.sendKeyStroke(KEY_BACKSPACE);
}
// for each sentence
for (int i = 0; i < 9; i++) {
// print sentence
DigiKeyboardFr.print(sentences[i]);

// wait for the people to read it
DigiKeyboardFr.delay(2000);

// delete it
for (int j = 0; j < strlen(sentences[i]); j++) {
DigiKeyboardFr.sendKeyStroke(KEY_BACKSPACE);
}

//wait
DigiKeyboardFr.delay(1000);
}
DigiKeyboardFr.print("Done !");
DigiKeyboardFr.delay(2000);
for (int i = 0; i < 6; i++) {
DigiKeyboardFr.sendKeyStroke(KEY_BACKSPACE);
}
}
245 changes: 124 additions & 121 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,129 +17,132 @@ DigiKeyboardFr KEYWORD1
# Constants (LITERAL1)
#######################################
MOD_CONTROL_LEFT LITERAL1
MOD_SHIFT_LEFT LITERAL1
MOD_ALT_LEFT LITERAL1
MOD_GUI_LEFT LITERAL1
MOD_SHIFT_LEFT LITERAL1
MOD_ALT_LEFT LITERAL1
MOD_GUI_LEFT LITERAL1
MOD_CONTROL_RIGHT LITERAL1
MOD_SHIFT_RIGHT LITERAL1
MOD_ALT_RIGHT LITERAL1
MOD_GUI_RIGHT LITERAL1
MOD_SHIFT_RIGHT LITERAL1
MOD_ALT_RIGHT LITERAL1
MOD_GUI_RIGHT LITERAL1

KEY_ARROW_RIGHT LITERAL1
KEY_ARROW_UP LITERAL1
KEY_ARROW_DOWN LITERAL1
KEY_ARROW_LEFT LITERAL1
KEY_ARROW_RIGHT LITERAL1
KEY_ARROW_UP LITERAL1
KEY_ARROW_DOWN LITERAL1
KEY_ARROW_LEFT LITERAL1

KEY_CAPSLOCK LITERAL1
KEY_NUMLOCK LITERAL1
KEY_ESC LITERAL1
KEY_PRINT_SCREEN LITERAL1
KEY_MUTE LITERAL1
KEY_VOLUME_UP LITERAL1
KEY_VOLUME_DOWN LITERAL1
KEY_COPY LITERAL1
KEY_PASTE LITERAL1
KEY_CUT LITERAL1
KEY_INSERT LITERAL1
KEY_END LITERAL1
KEY_DELETE LITERAL1
KEY_BACKSPACE LITERAL1

KEY_F1 LITERAL1
KEY_F2 LITERAL1
KEY_F3 LITERAL1
KEY_F4 LITERAL1
KEY_F5 LITERAL1
KEY_F6 LITERAL1
KEY_F7 LITERAL1
KEY_F8 LITERAL1
KEY_F9 LITERAL1
KEY_F10 LITERAL1
KEY_F11 LITERAL1
KEY_F12 LITERAL1
KEY_CAPSLOCK LITERAL1
KEY_NUMLOCK LITERAL1
KEY_ESC LITERAL1
KEY_PRINT_SCREEN LITERAL1
KEY_MUTE LITERAL1
KEY_VOLUME_UP LITERAL1
KEY_VOLUME_DOWN LITERAL1
KEY_COPY LITERAL1
KEY_PASTE LITERAL1
KEY_CUT LITERAL1
KEY_INSERT LITERAL1
KEY_END LITERAL1

KEY_A LITERAL1
KEY_B LITERAL1
KEY_C LITERAL1
KEY_D LITERAL1
KEY_E LITERAL1
KEY_F LITERAL1
KEY_G LITERAL1
KEY_H LITERAL1
KEY_I LITERAL1
KEY_J LITERAL1
KEY_K LITERAL1
KEY_L LITERAL1
KEY_M LITERAL1
KEY_N LITERAL1
KEY_O LITERAL1
KEY_P LITERAL1
KEY_Q LITERAL1
KEY_R LITERAL1
KEY_S LITERAL1
KEY_T LITERAL1
KEY_U LITERAL1
KEY_V LITERAL1
KEY_W LITERAL1
KEY_X LITERAL1
KEY_Y LITERAL1
KEY_Z LITERAL1
KEY_1 LITERAL1
KEY_2 LITERAL1
KEY_3 LITERAL1
KEY_4 LITERAL1
KEY_5 LITERAL1
KEY_6 LITERAL1
KEY_7 LITERAL1
KEY_8 LITERAL1
KEY_9 LITERAL1
KEY_0 LITERAL1
KEY_ENTER LITERAL1
KEY_SPACE LITERAL1
KEY_F1 LITERAL1
KEY_F2 LITERAL1
KEY_F3 LITERAL1
KEY_F4 LITERAL1
KEY_F5 LITERAL1
KEY_F6 LITERAL1
KEY_F7 LITERAL1
KEY_F8 LITERAL1
KEY_F9 LITERAL1
KEY_F10 LITERAL1
KEY_F11 LITERAL1
KEY_F12 LITERAL1
KEY_ARROW_LEFT LITERAL1
KEY_FR_A LITERAL1
KEY_FR_B LITERAL1
KEY_FR_C LITERAL1
KEY_FR_D LITERAL1
KEY_FR_E LITERAL1
KEY_FR_F LITERAL1
KEY_FR_G LITERAL1
KEY_FR_H LITERAL1
KEY_FR_I LITERAL1
KEY_FR_J LITERAL1
KEY_FR_K LITERAL1
KEY_FR_L LITERAL1
KEY_FR_M LITERAL1
KEY_FR_N LITERAL1
KEY_FR_O LITERAL1
KEY_FR_P LITERAL1
KEY_FR_Q LITERAL1
KEY_FR_R LITERAL1
KEY_FR_S LITERAL1
KEY_FR_T LITERAL1
KEY_FR_U LITERAL1
KEY_FR_V LITERAL1
KEY_FR_W LITERAL1
KEY_FR_X LITERAL1
KEY_FR_Y LITERAL1
KEY_FR_Z LITERAL1
KEY_FR_0 LITERAL1
KEY_FR_1 LITERAL1
KEY_FR_2 LITERAL1
KEY_FR_3 LITERAL1
KEY_FR_4 LITERAL1
KEY_FR_5 LITERAL1
KEY_FR_6 LITERAL1
KEY_FR_7 LITERAL1
KEY_FR_8 LITERAL1
KEY_FR_9 LITERAL1
KEY_F1 LITERAL1
KEY_F2 LITERAL1
KEY_F3 LITERAL1
KEY_F4 LITERAL1
KEY_F5 LITERAL1
KEY_F6 LITERAL1
KEY_F7 LITERAL1
KEY_F8 LITERAL1
KEY_F9 LITERAL1
KEY_F10 LITERAL1
KEY_F11 LITERAL1
KEY_F12 LITERAL1

KEY_A LITERAL1
KEY_B LITERAL1
KEY_C LITERAL1
KEY_D LITERAL1
KEY_E LITERAL1
KEY_F LITERAL1
KEY_G LITERAL1
KEY_H LITERAL1
KEY_I LITERAL1
KEY_J LITERAL1
KEY_K LITERAL1
KEY_L LITERAL1
KEY_M LITERAL1
KEY_N LITERAL1
KEY_O LITERAL1
KEY_P LITERAL1
KEY_Q LITERAL1
KEY_R LITERAL1
KEY_S LITERAL1
KEY_T LITERAL1
KEY_U LITERAL1
KEY_V LITERAL1
KEY_W LITERAL1
KEY_X LITERAL1
KEY_Y LITERAL1
KEY_Z LITERAL1
KEY_1 LITERAL1
KEY_2 LITERAL1
KEY_3 LITERAL1
KEY_4 LITERAL1
KEY_5 LITERAL1
KEY_6 LITERAL1
KEY_7 LITERAL1
KEY_8 LITERAL1
KEY_9 LITERAL1
KEY_0 LITERAL1
KEY_ENTER LITERAL1
KEY_SPACE LITERAL1
KEY_F1 LITERAL1
KEY_F2 LITERAL1
KEY_F3 LITERAL1
KEY_F4 LITERAL1
KEY_F5 LITERAL1
KEY_F6 LITERAL1
KEY_F7 LITERAL1
KEY_F8 LITERAL1
KEY_F9 LITERAL1
KEY_F10 LITERAL1
KEY_F11 LITERAL1
KEY_F12 LITERAL1
KEY_ARROW_LEFT LITERAL1
KEY_FR_A LITERAL1
KEY_FR_B LITERAL1
KEY_FR_C LITERAL1
KEY_FR_D LITERAL1
KEY_FR_E LITERAL1
KEY_FR_F LITERAL1
KEY_FR_G LITERAL1
KEY_FR_H LITERAL1
KEY_FR_I LITERAL1
KEY_FR_J LITERAL1
KEY_FR_K LITERAL1
KEY_FR_L LITERAL1
KEY_FR_M LITERAL1
KEY_FR_N LITERAL1
KEY_FR_O LITERAL1
KEY_FR_P LITERAL1
KEY_FR_Q LITERAL1
KEY_FR_R LITERAL1
KEY_FR_S LITERAL1
KEY_FR_T LITERAL1
KEY_FR_U LITERAL1
KEY_FR_V LITERAL1
KEY_FR_W LITERAL1
KEY_FR_X LITERAL1
KEY_FR_Y LITERAL1
KEY_FR_Z LITERAL1
KEY_FR_0 LITERAL1
KEY_FR_1 LITERAL1
KEY_FR_2 LITERAL1
KEY_FR_3 LITERAL1
KEY_FR_4 LITERAL1
KEY_FR_5 LITERAL1
KEY_FR_6 LITERAL1
KEY_FR_7 LITERAL1
KEY_FR_8 LITERAL1
KEY_FR_9 LITERAL1
5 changes: 4 additions & 1 deletion src/DigiKeyboardFr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#define KEY_ARROW_DOWN 81
#define KEY_ARROW_LEFT 80

#define KEY_DELETE 0x4C
#define KEY_BACKSPACE 0x2A

#define KEY_CAPSLOCK 57
#define KEY_NUMLOCK 83
#define KEY_ESC 41
Expand Down Expand Up @@ -126,7 +129,7 @@ const uint16_t ascii_to_scan_code_table_fr[] PROGMEM = {
33, // '
34, // (
45, // )
49, // *
85, // *
46|FR_MOD_SHIFT_LEFT, // +
16, // ,
35, // -
Expand Down

0 comments on commit 0bc6a21

Please sign in to comment.