Add new more reliable software UART for the XPLAINBridge project by David Prentice...
[pub/USBasp.git] / Projects / AVRISP / AVRISP.c
index 4eb02d2..02292aa 100644 (file)
@@ -48,7 +48,7 @@ int main(void)
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 \r
        for (;;)\r
-       {
+       {\r
                Process_AVRISP_Commands();\r
                \r
                V2Params_UpdateParamValues();\r
@@ -70,6 +70,7 @@ void SetupHardware(void)
        /* Hardware Initialization */\r
        LEDs_Init();\r
        USB_Init();\r
+       SerialStream_Init(9600, true);\r
 \r
        #if defined(ADC)\r
        /* Initialize the ADC converter for VTARGET level detection on supported AVR models */\r
@@ -111,20 +112,24 @@ void EVENT_USB_Device_ConfigurationChanged(void)
        }\r
 }\r
 \r
-/** Processes incomming V2 Protocol commands from the host, returning a response when required. */
-void Process_AVRISP_Commands(void)
-{
+/** Processes incoming V2 Protocol commands from the host, returning a response when required. */\r
+void Process_AVRISP_Commands(void)\r
+{\r
        /* Device must be connected and configured for the task to run */\r
        if (USB_DeviceState != DEVICE_STATE_Configured)\r
-         return;
-
+         return;\r
+\r
        Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);\r
-       
-       /* Check to see if a V2 Protocol command has been received */
+       \r
+       /* Check to see if a V2 Protocol command has been received */\r
        if (Endpoint_IsOUTReceived())\r
-       {
-               /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
+       {\r
+               LEDs_SetAllLEDs(LEDMASK_BUSY);\r
+\r
+               /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */\r
                V2Protocol_ProcessCommand();\r
+\r
+               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
        }\r
-}
-
+}\r
+\r