usbkvm_fw5.ino 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. RemdesKVM USB-KVM
  3. Firmware for PCB design v4 or above
  4. Author: tobychui
  5. Upload Settings
  6. CH552G
  7. 24Mhz (Internal)
  8. */
  9. #include <Serial.h>
  10. //Pins definations
  11. #define ATX_PWR_LED 15
  12. #define ATX_HDD_LED 16
  13. #define ATX_RST_BTN 33
  14. #define ATX_PWR_BTN 34
  15. #define USB_MS_PWR 30
  16. #define USB_MS_SW 31
  17. // Set the USB descriptor exposed to the slave device
  18. /*
  19. void setup_keyboard_chip_cfg() {
  20. //Set manufacturer string
  21. uint8_t manufacturer_string[9] = { 0x00, 0x07, 'i', 'm', 'u', 's', 'l', 'a', 'b' };
  22. send_cmd(0x0B, manufacturer_string, 9);
  23. flush_cmd_resp();
  24. //Set product string
  25. uint8_t product_string[11] = { 0x01, 0x09, 'R', 'e', 'm', 'd', 'e', 's', 'K', 'V', 'M' };
  26. send_cmd(0x0B, product_string, 11);
  27. flush_cmd_resp();
  28. }
  29. */
  30. void setup() {
  31. //Setup ATX Pins
  32. pinMode(ATX_PWR_LED, INPUT);
  33. pinMode(ATX_HDD_LED, INPUT);
  34. pinMode(ATX_RST_BTN, OUTPUT);
  35. pinMode(ATX_PWR_BTN, OUTPUT);
  36. pinMode(USB_MS_PWR, OUTPUT);
  37. pinMode(USB_MS_SW, OUTPUT); //Currently not used
  38. digitalWrite(ATX_RST_BTN, LOW);
  39. digitalWrite(ATX_PWR_BTN, LOW);
  40. digitalWrite(USB_MS_PWR, LOW);
  41. digitalWrite(USB_MS_SW, LOW);
  42. Serial0_begin(9600);
  43. delay(100);
  44. }
  45. void loop() {
  46. delay(5000);
  47. USBSerial_print(".");
  48. }