mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-04-25 16:23:41 -05:00
Fixing PS2 examples
This commit is contained in:
parent
c23056e51a
commit
232a834c3b
|
|
@ -6,6 +6,7 @@
|
|||
#include "../../../lib/LinkPS2Keyboard.hpp"
|
||||
|
||||
void log(std::string text);
|
||||
static std::string scanCodes = "";
|
||||
static std::string output = "";
|
||||
static u32 irqs = 0;
|
||||
inline void VBLANK() {}
|
||||
|
|
@ -15,9 +16,9 @@ void SERIAL() {
|
|||
}
|
||||
|
||||
// (1) Create a LinkPS2Keyboard instance
|
||||
LinkPS2Keyboard* linkPS2Keyboard = new LinkPS2Keyboard([](u8 event) {
|
||||
LinkPS2Keyboard* linkPS2Keyboard = new LinkPS2Keyboard([](u8 scanCode) {
|
||||
// (4) Handle events in the callback sent to LinkPS2Keyboard's constructor!
|
||||
output += std::to_string(event) + "|";
|
||||
scanCodes += std::to_string(scanCode) + "|";
|
||||
});
|
||||
|
||||
void init() {
|
||||
|
|
@ -49,6 +50,8 @@ int main() {
|
|||
VBlankIntrWait();
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
output += std::to_string(irqs) + " - " + scanCodes;
|
||||
}
|
||||
|
||||
// Print
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ int main() {
|
|||
// (4) Get a report
|
||||
int data[3];
|
||||
linkPS2Mouse->report(data);
|
||||
log(std::to_string(data[0]) + ": " + "(" + std::to_string(data[1]) +
|
||||
", " + std::to_string(data[2]) + ")");
|
||||
output += std::to_string(data[0]) + ": " + "(" + std::to_string(data[1]) +
|
||||
", " + std::to_string(data[2]) + ")";
|
||||
}
|
||||
|
||||
// Print
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user