reformat board_qc so it is not ugly, and follows industry standards

This commit is contained in:
Andrew J. Kroll 2013-10-21 13:52:35 -04:00
parent 13d625e6be
commit 18e401e55a

View file

@ -16,9 +16,7 @@ USB_DEVICE_DESCRIPTOR buf;
USB Usb; USB Usb;
//USBHub hub(&Usb); //USBHub hub(&Usb);
void setup() {
void setup()
{
laststate = 0; laststate = 0;
Serial.begin(115200); Serial.begin(115200);
E_Notify(PSTR("\r\nCircuits At Home 2011"), 0x80); E_Notify(PSTR("\r\nCircuits At Home 2011"), 0x80);
@ -136,9 +134,7 @@ void setup()
E_Notify(PSTR("\r\nChecking USB device communication.\r\n"), 0x80); E_Notify(PSTR("\r\nChecking USB device communication.\r\n"), 0x80);
} }
void loop() {
void loop()
{
delay(200); delay(200);
Usb.Task(); Usb.Task();
usbstate = Usb.getUsbTaskState(); usbstate = Usb.getUsbTaskState();
@ -168,8 +164,7 @@ void loop()
if (rcode) { if (rcode) {
E_Notify(PSTR("\r\nError reading device descriptor. Error code "), 0x80); E_Notify(PSTR("\r\nError reading device descriptor. Error code "), 0x80);
print_hex(rcode, 8); print_hex(rcode, 8);
} } else {
else {
/**/ /**/
E_Notify(PSTR("\r\nDescriptor Length:\t"), 0x80); E_Notify(PSTR("\r\nDescriptor Length:\t"), 0x80);
print_hex(buf.bLength, 8); print_hex(buf.bLength, 8);
@ -215,8 +210,7 @@ void loop()
}//loop()... }//loop()...
/* constantly transmits 0x55 via SPI to aid probing */ /* constantly transmits 0x55 via SPI to aid probing */
void halt55() void halt55() {
{
E_Notify(PSTR("\r\nUnrecoverable error - test halted!!"), 0x80); E_Notify(PSTR("\r\nUnrecoverable error - test halted!!"), 0x80);
E_Notify(PSTR("\r\n0x55 pattern is transmitted via SPI"), 0x80); E_Notify(PSTR("\r\n0x55 pattern is transmitted via SPI"), 0x80);
@ -226,9 +220,9 @@ void halt55()
Usb.regWr(0x55, 0x55); Usb.regWr(0x55, 0x55);
} }
} }
/* prints hex numbers with leading zeroes */ /* prints hex numbers with leading zeroes */
void print_hex(int v, int num_places) void print_hex(int v, int num_places) {
{
int mask = 0, n, num_nibbles, digit; int mask = 0, n, num_nibbles, digit;
for (n = 1; n <= num_places; n++) { for (n = 1; n <= num_places; n++) {
@ -245,9 +239,9 @@ void print_hex(int v, int num_places)
Serial.print(digit, HEX); Serial.print(digit, HEX);
} while (--num_nibbles); } while (--num_nibbles);
} }
/* prints "Press any key" and returns when key is pressed */ /* prints "Press any key" and returns when key is pressed */
void press_any_key() void press_any_key() {
{
E_Notify(PSTR("\r\nPress any key to continue..."), 0x80); E_Notify(PSTR("\r\nPress any key to continue..."), 0x80);
while (Serial.available() <= 0); //wait for input while (Serial.available() <= 0); //wait for input
Serial.read(); //empty input buffer Serial.read(); //empty input buffer