Hallo!
Ich bin gerade am Code des V-USB und dabei auf ein Problem gestoßen.
Es gibt eine Funktion, wo die Buttons geprüft werden:
1 | static void buildReport(void){
|
2 |
|
3 | uchar key;
|
4 |
|
5 | if(newReport == 0){
|
6 | if (buttonChanged_B1 == 1){
|
7 | if (buttonState_B1 != 0){ // if button 1 is released
|
8 | key = 0; //button released event
|
9 | }
|
10 | else { //if button 1 is pressed
|
11 | key = 30; // key = '0'
|
12 | }
|
13 | buttonChanged_B1 = 0;
|
14 | reportBuffer[2] = key;
|
15 | }
|
16 | ...
|
Habt ihr eine Idee, wie ich in ein uchar die Pfeile packe?
Ascii von Pfeilen sind doppelt, heißt: für "UP" 224 und 72; für "DOWN"
224 und 80.
1 | static uchar reportBuffer[8] = {0,0,0,0,0,0,0,0}; /* buffer for HID reports */
|
2 |
|
3 | /* Reportbuffer format:
|
4 |
|
5 | 0 Modifier byte
|
6 | 1 reserved
|
7 | 2 keycode array (0)
|
8 | 3 keycode array (1)
|
9 | 4 keycode array (2)
|
10 | 5 keycode array (3)
|
11 | 6 keycode array (4)
|
12 | 7 keycode array (5)
|
13 |
|
14 | an example of a reportBuffer for a CTRL+ALT+Delete keypress:
|
15 |
|
16 | {((1<<0)+(1<<2)),0,76,0,0,0,0,0}
|
kann ich so schicken: {((224)+(72)),0,0,0,0,0,0,0}
oder verstehe ich es falsch? -> (1<<0)+(1<<2)
Vielen Dank im Voraus!