aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/nuevo_diskloader/src/DiskLoader.cpp
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-10-24 22:12:45 -0400
committerZach Eveland <zeveland@blacklabel-development.com>2011-10-24 22:12:45 -0400
commit9a5c50d5864e9a18c856edb446ed2565037260e2 (patch)
tree863fff8ff2d3089f924ecee416f2e5fb20b7969b /bootloaders/nuevo_diskloader/src/DiskLoader.cpp
parentb6f5fae14f4eb9c0cc21f45b9e8f6211cb1dc1f4 (diff)
fixed logic bug in waiting for synch. stripped out all Serial stuff
Diffstat (limited to 'bootloaders/nuevo_diskloader/src/DiskLoader.cpp')
-rw-r--r--bootloaders/nuevo_diskloader/src/DiskLoader.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp
index 724a130..cbb709b 100644
--- a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp
+++ b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp
@@ -3,6 +3,7 @@
*/
#include "Platform.h"
+#include "USBCore.h"
//extern "C"
void entrypoint(void) __attribute__ ((naked)) __attribute__ ((section (".vectors")));
@@ -123,9 +124,12 @@ int main()
u16 address = 0;
for (;;)
{
- while (Serial.available() < 1)
- ;
- u8 cmd = Serial.read();
+// while (Serial.available() < 1)
+// ;
+// u8 cmd = Serial.read();
+ while (!USB_Available(CDC_RX))
+ ;
+ u8 cmd = USB_Recv(CDC_RX);
// Read packet contents
u8 len;
@@ -180,8 +184,15 @@ int main()
}
// Check sync
- if (Serial.available() > 0 && Serial.read() != ' ')
+// if (Serial.available() > 0 && Serial.read() != ' ')
+// break;
+// if (USB_Available(CDC_RX) && USB_Recv(CDC_RX) != ' ')
+ u16 countdown = 5000;
+ while (!USB_Available(CDC_RX) && countdown-- > 10)
+ ;
+ if (USB_Recv(CDC_RX) != ' ')
break;
+
USB_Send(CDC_TX, &_inSync, 1);
if (send)