Skip to content

Instantly share code, notes, and snippets.

View deldrid1's full-sized avatar

Austin Eldridge deldrid1

  • FareDrop
  • Knoxville, TN
View GitHub Profile
@deldrid1
deldrid1 / basic.usb.device.nut
Last active November 16, 2016 19:00 — forked from ElectricImpSampleCode/basic.usb.device.nut
Electric Imp imp API usb.configure() example
function processUSB(type, details) {
// Function called in response to a USB bus event
switch (type) {
case USB_DEVICE_CONNECTED:
local descriptors = details.descriptors;
server.log("USB device " + descriptors.product + " connected at speed " + details.speed + "Mbps");
server.log(format("USB = 0x%04x", descriptors.usb));
server.log(format("class = 0x%02x", descriptors["class"]));
server.log(format("subclass = 0x%02x", descriptors.subclass));
server.log(format("protocol = 0x%02x", descriptors.protocol));