Implement USB HID Device Support for ESP32-S2 (#5538)

* Add support and example for USB HID Devices
* Add support and example for USB Vendor
This commit is contained in:
Me No Dev
2021-08-23 17:27:34 +03:00
committed by GitHub
parent b1d072df9f
commit c45cff5f83
66 changed files with 3259 additions and 47 deletions

View File

@ -0,0 +1,40 @@
/*
Keyboard test
Reads a byte from the serial port, sends a keystroke back.
The sent keystroke is one higher than what's received, e.g. if you send a,
you get b, send A you get B, and so forth.
The circuit:
- none
created 21 Oct 2011
modified 27 Mar 2012
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/KeyboardSerial
*/
#include "USB.h"
#include "USBHIDKeyboard.h"
USBHIDKeyboard Keyboard;
void setup() {
// open the serial port:
Serial.begin(115200);
// initialize control over the keyboard:
Keyboard.begin();
USB.begin();
}
void loop() {
// check for incoming serial data:
if (Serial.available() > 0) {
// read incoming serial data:
char inChar = Serial.read();
// Type the next ASCII value from what you received:
Keyboard.write(inChar + 1);
}
}