/*
  RemdesKVM USB-KVM
  Firmware for PCB design v4 or above

  Author: tobychui

  Upload Settings
  CH552G  
  24Mhz (Internal)
*/
#include <Serial.h>

//Pins definations
#define ATX_PWR_LED 15
#define ATX_HDD_LED 16
#define ATX_RST_BTN 33
#define ATX_PWR_BTN 34
#define USB_MS_PWR 30
#define USB_MS_SW 31



// Set the USB descriptor exposed to the slave device
/*
void setup_keyboard_chip_cfg() {
  //Set manufacturer string
  uint8_t manufacturer_string[9] = { 0x00, 0x07, 'i', 'm', 'u', 's', 'l', 'a', 'b' };
  send_cmd(0x0B, manufacturer_string, 9);
  flush_cmd_resp();
  //Set product string
  uint8_t product_string[11] = { 0x01, 0x09, 'R', 'e', 'm', 'd', 'e', 's', 'K', 'V', 'M' };
  send_cmd(0x0B, product_string, 11);
  flush_cmd_resp();
}
*/

void setup() {
  //Setup ATX Pins
  pinMode(ATX_PWR_LED, INPUT);
  pinMode(ATX_HDD_LED, INPUT);
  pinMode(ATX_RST_BTN, OUTPUT);
  pinMode(ATX_PWR_BTN, OUTPUT);
  pinMode(USB_MS_PWR, OUTPUT);
  pinMode(USB_MS_SW, OUTPUT); //Currently not used

  digitalWrite(ATX_RST_BTN, LOW);
  digitalWrite(ATX_PWR_BTN, LOW);
  digitalWrite(USB_MS_PWR, LOW);
  digitalWrite(USB_MS_SW, LOW);

  Serial0_begin(9600);
  delay(100);
}

void loop() {
  delay(5000);
  USBSerial_print(".");
}