mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
parent
231773cae9
commit
5f34c63660
17
examples/device/hid_generic_inout/hid_test.js
Normal file
17
examples/device/hid_generic_inout/hid_test.js
Normal file
@ -0,0 +1,17 @@
|
||||
var HID = require('node-hid');
|
||||
var devices = HID.devices();
|
||||
var deviceInfo = devices.find( function(d) {
|
||||
var isNRF = d.vendorId===0Xcafe && d.productId===0X4004;
|
||||
return isNRF;
|
||||
});
|
||||
if( deviceInfo ) {
|
||||
console.log(deviceInfo)
|
||||
var device = new HID.HID( deviceInfo.path );
|
||||
device.on("data", function(data) {console.log(data)});
|
||||
|
||||
device.on("error", function(err) {console.log(err)});
|
||||
|
||||
setInterval(function () {
|
||||
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
|
||||
},500)
|
||||
}
|
@ -85,7 +85,7 @@ uint8_t const desc_configuration[] =
|
||||
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
||||
|
||||
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
|
||||
TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x80 | EPNUM_HID, EPNUM_HID, 16, 10)
|
||||
TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x80 | EPNUM_HID, EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10)
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ bool tud_hid_ready(void)
|
||||
|
||||
bool tud_hid_report(uint8_t report_id, void const* report, uint8_t len)
|
||||
{
|
||||
TU_VERIFY( tud_hid_ready() && (len < CFG_TUD_HID_BUFSIZE) );
|
||||
TU_VERIFY( tud_hid_ready() && (len <= CFG_TUD_HID_BUFSIZE) );
|
||||
|
||||
uint8_t itf = 0;
|
||||
hidd_interface_t * p_hid = &_hidd_itf[itf];
|
||||
|
Loading…
x
Reference in New Issue
Block a user