-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca9f0c2
commit a66fba6
Showing
4 changed files
with
89 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,34 @@ | ||
#include "squirrel.h" | ||
#include "squirrel_keyboard.h" | ||
#include "squirrel_quantum.h" | ||
|
||
// test: keyboard_press + keyboard_release end-to-end test in squirrel_quantum.c | ||
int main() { | ||
// keyboard_press | ||
struct key test_key; | ||
for (uint8_t i = 0; i <= 255; i++) { | ||
// FALSE becomes TRUE | ||
for (uint8_t j = 0; j <= 255; j++) { | ||
keycodes[j] = false; | ||
} | ||
keyboard_press(&test_key, i); | ||
if (keycodes[i] == false) { | ||
struct key test_key; // values unused | ||
for (uint8_t keycode; keycode <= 127; keycode++) { | ||
// Off becomes on | ||
keycodes[keycode] = false; | ||
keyboard_press(&test_key, 0, 0, 1, keycode); | ||
if (keycodes[keycode] != true) { | ||
return 1; | ||
} | ||
|
||
// TRUE stays TRUE | ||
for (uint8_t j = 0; j <= 255; j++) { | ||
keycodes[j] = true; | ||
} | ||
keyboard_press(&test_key, i); | ||
if (keycodes[i] == false) { | ||
// On stays on | ||
keyboard_press(&test_key, 0, 0, 1, keycode); | ||
if (keycodes[keycode] != true) { | ||
return 2; | ||
} | ||
}; | ||
|
||
// keyboard_release | ||
for (uint8_t i = 0; i <= 255; i++) { | ||
// TRUE becomes FALSE | ||
for (uint8_t j = 0; j <= 255; j++) { | ||
keycodes[j] = true; | ||
} | ||
keyboard_release(&test_key, i); | ||
if (keycodes[i] == true) { | ||
// On becomes off | ||
keycodes[keycode] = true; | ||
keyboard_release(&test_key, 0, 0, 1, keycode); | ||
if (keycodes[keycode] != false) { | ||
return 3; | ||
} | ||
// FALSE stays FALSE | ||
for (uint8_t j = 0; j <= 255; j++) { | ||
keycodes[j] = false; | ||
} | ||
keyboard_release(&test_key, i); | ||
if (keycodes[i] == true) { | ||
// Off stays off | ||
keyboard_release(&test_key, 0, 0, 1, keycode); | ||
if (keycodes[keycode] != false) { | ||
return 4; | ||
} | ||
}; | ||
} | ||
return 0; | ||
}; |