Removed HID_Test example
Does not compile with the current settings, more a leftover from developing.
This commit is contained in:
parent
6b6304a1bb
commit
4251522cf7
2 changed files with 2 additions and 169 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dev/*
|
||||
*.pdn
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
pinMode(7, INPUT_PULLUP);
|
||||
pinMode(8, INPUT_PULLUP);
|
||||
pinMode(9, INPUT_PULLUP);
|
||||
pinMode(10, INPUT_PULLUP);
|
||||
pinMode(2, INPUT_PULLUP);
|
||||
pinMode(3, INPUT_PULLUP);
|
||||
|
||||
// 7052 279
|
||||
Keyboard.begin();
|
||||
Gamepad.begin();
|
||||
hid_keyboard_leds = 0; //test to access it from here
|
||||
}
|
||||
|
||||
uint32_t eventBaud = 0;
|
||||
|
||||
void loop() {
|
||||
|
||||
if (!digitalRead(7)) {
|
||||
digitalWrite(13, 1);
|
||||
Mouse.moveTo(1000, 1000);
|
||||
delay(300);
|
||||
digitalWrite(13, 0);
|
||||
}
|
||||
|
||||
if (!digitalRead(8)) {
|
||||
digitalWrite(13, 1);
|
||||
Mouse.move(100, 0);
|
||||
delay(300);
|
||||
digitalWrite(13, 0);
|
||||
}
|
||||
|
||||
if (!digitalRead(9)) {
|
||||
digitalWrite(13, 1);
|
||||
Mouse.move(-100, 0);
|
||||
delay(300);
|
||||
digitalWrite(13, 0);
|
||||
}
|
||||
|
||||
if (!digitalRead(10)) {
|
||||
uint8_t k[8] = {0};
|
||||
k[1] = 1;
|
||||
|
||||
k[2] = 4;
|
||||
k[3] = 5;
|
||||
HID_SendReport(HID_REPORTID_KEYBOARD, &k, sizeof(k));
|
||||
Keyboard.releaseAll();
|
||||
delay(300);
|
||||
}
|
||||
if (!digitalRead(2)) {
|
||||
digitalWrite(13, 1);
|
||||
System.write(SYSTEM_SLEEP);
|
||||
delay(300);
|
||||
digitalWrite(13, 0);
|
||||
}
|
||||
if (!digitalRead(3)) {
|
||||
digitalWrite(13, 1);
|
||||
USBDevice.wakeupHost();
|
||||
delay(300);
|
||||
digitalWrite(13, 0);
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
// let the Serial receive all bytes and discard the first bytes
|
||||
// this is to ensure you only input a single char and no string
|
||||
char c;
|
||||
delay(300);
|
||||
int length = Serial.available();
|
||||
while (Serial.available())
|
||||
c = Serial.read();
|
||||
if (length > 1) {
|
||||
Serial.println("Please only input a single character or deactivate linefeed!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (c != -1) {
|
||||
Serial.println(c);
|
||||
switch (c) {
|
||||
case 'a':
|
||||
Keyboard.write('b');
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
Consumer.write(MEDIA_PLAY_PAUSE);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
{
|
||||
// uint8_t k[8] = {0};
|
||||
// k[1] = 1 << 4;
|
||||
// //k[2] = 4;
|
||||
// HID_SendReport(HID_REPORTID_KEYBOARD, &k, sizeof(k));
|
||||
// Keyboard.releaseAll();
|
||||
break;
|
||||
}
|
||||
|
||||
case 's':
|
||||
System.write(SYSTEM_SLEEP);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
Mouse.move(100, 0);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
Mouse.move(-100, 0);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
Mouse.moveTo(1000, 1000);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'C':
|
||||
Keyboard.write(KEY_CAPS_LOCK);
|
||||
Serial.println("Leds");
|
||||
Serial.println(Keyboard.getLeds(), BIN);
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
Keyboard.print("Testing USB functions xyz");
|
||||
break;
|
||||
|
||||
case '\r':
|
||||
case '\n':
|
||||
Serial.println("Please only input a single character!");
|
||||
break;
|
||||
|
||||
case 'g': {
|
||||
// press button 1-32 and reset (34 becaue its written later)
|
||||
static uint8_t count = 1;
|
||||
Gamepad.press(count++);
|
||||
if (count == 34) {
|
||||
Gamepad.releaseAll();
|
||||
count = 1;
|
||||
}
|
||||
Gamepad.write();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
Serial.println("Serial");
|
||||
Serial.println(Serial.dtr());
|
||||
Serial.println(Serial.rts());
|
||||
Serial.println(Serial.baud());
|
||||
Serial.println(Serial.stopbits());
|
||||
Serial.println(Serial.paritytype());
|
||||
Serial.println(Serial.numbits());
|
||||
break;
|
||||
|
||||
default:
|
||||
Serial.println("unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (eventBaud) {
|
||||
Serial.println("Event");
|
||||
Serial.println(eventBaud);
|
||||
eventBaud = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CDC_LineEncodingEvent(void)
|
||||
{
|
||||
eventBaud = Serial.baud();
|
||||
}
|
||||
Loading…
Reference in a new issue