-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCDC_KEYBOARD.ino
More file actions
41 lines (30 loc) · 872 Bytes
/
Copy pathCDC_KEYBOARD.ino
File metadata and controls
41 lines (30 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
CDC + HID Keyboard
A simple examples echoes next character of data it receives.
created 2022
by Noteolvides for use with CH55xduino
This example code is in the public domain.
*/
#ifndef USER_USB_RAM
#error "This example needs to be compiled with a USER USB setting"
#error "Tools--> USB Settings--> USER CODE w/266 USB Ram"
#endif
#include "src/CUSTOM_USB/USBCDC.h"
#include "src/CUSTOM_USB/USBHIDKeyboard.h"
void setup() {
USBInit();
}
void loop() {
while (USBSerial_available()) {
char serialChar = USBSerial_read();
if ((serialChar != '\n') && (serialChar != '\r') ) {
USBSerial_print_s("Recived:");
USBSerial_println_c(serialChar);
USBSerial_print_s("Sending next character....");
USBSerial_println_c(serialChar+1);
USBSerial_flush();
delay(500);
Keyboard_write(serialChar+1);
}
}
}