add hid_test.py for testing #58
add feather nrf52840 express to supported board
This commit is contained in:
15
examples/device/hid_generic_inout/hid_test.py
Normal file
15
examples/device/hid_generic_inout/hid_test.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Install python3 HID package https://pypi.org/project/hid/
|
||||
import hid
|
||||
|
||||
USB_VID = 0xcafe
|
||||
|
||||
for dict in hid.enumerate(0xcafe):
|
||||
print(dict)
|
||||
dev = hid.Device(dict['vendor_id'], dict['product_id'])
|
||||
if dev:
|
||||
while True:
|
||||
# Get input from console and encode to UTF8 for array of chars.
|
||||
str_out = input("Send text to HID Device : ").encode('utf-8')
|
||||
dev.write(str_out)
|
||||
str_in = dev.read(64)
|
||||
print("Received from HID Device:", str_in, '\n')
|
||||
@@ -30,6 +30,15 @@
|
||||
#include "bsp/board.h"
|
||||
#include "tusb.h"
|
||||
|
||||
/* This example demonstrate HID Generic raw Input & Output.
|
||||
* It will receive data from Host (In endpoint) and echo back (Out endpoint).
|
||||
* HID Report descriptor use vendor for usage page (using template TUD_HID_REPORT_DESC_GENERIC_INOUT)
|
||||
*
|
||||
* Run 'python3 hid_test.py' on your PC to send and receive data to this device.
|
||||
* Python and `hid` package is required, for installation please follow
|
||||
* https://pypi.org/project/hid/
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF PROTYPES
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user