-
Notifications
You must be signed in to change notification settings - Fork 90
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
Showing
4 changed files
with
66 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "usb_keyboard_hid_syscalls.h" | ||
|
||
bool libtock_usb_keyboard_hid_exists(void) { | ||
return driver_exists(DRIVER_NUM_USBKEYBOARDHID); | ||
} | ||
|
||
returncode_t libtock_usb_keyboard_hid_set_upcall(subscribe_upcall callback, void* opaque) { | ||
subscribe_return_t sval = subscribe(DRIVER_NUM_USBKEYBOARDHID, 0, callback, opaque); | ||
return tock_subscribe_return_to_returncode(sval); | ||
} | ||
|
||
returncode_t libtock_usb_keyboard_hid_set_readwrite_allow_send_buffer(uint8_t* buffer, uint32_t len) { | ||
allow_rw_return_t aval = allow_readwrite(DRIVER_NUM_USBKEYBOARDHID, 1, (void*) buffer, len); | ||
return tock_allow_rw_return_to_returncode(aval); | ||
} | ||
|
||
returncode_t libtock_usb_keyboard_hid_command_send(void) { | ||
syscall_return_t cval = command(DRIVER_NUM_USBKEYBOARDHID, 1, 0, 0); | ||
return tock_command_return_novalue_to_returncode(cval); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "tock.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define DRIVER_NUM_USBKEYBOARDHID 0x90005 | ||
|
||
// Check if this driver exists. | ||
bool libtock_usb_keyboard_hid_exists(void); | ||
|
||
// Configure the upcall for send/receive events. | ||
returncode_t libtock_usb_keyboard_hid_set_upcall(subscribe_upcall callback, void* opaque); | ||
|
||
// Set the buffer for sending data. | ||
returncode_t libtock_usb_keyboard_hid_set_readwrite_allow_send_buffer(uint8_t* buffer, uint32_t len); | ||
|
||
// Command to send the keyboard press to the host. | ||
returncode_t libtock_usb_keyboard_hid_command_send(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
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