X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f547eb36080dacf275cd94fc3ddfb4c618c587fa..1fa27139f5c195c0d7147dac0c5332a6ea10229a:/Projects/AVRISP/AVRISP.c diff --git a/Projects/AVRISP/AVRISP.c b/Projects/AVRISP/AVRISP.c index ce16aebfa..c0572fca2 100644 --- a/Projects/AVRISP/AVRISP.c +++ b/Projects/AVRISP/AVRISP.c @@ -34,9 +34,6 @@ * the project and is responsible for the initial application hardware configuration. */ -// TODO: Add in software SPI for lower programming speeds below 125KHz -// TODO: Add reversed target connector checks - #include "AVRISP.h" /** Main program entry point. This routine contains the overall program flow, including initial @@ -46,19 +43,16 @@ int main(void) { SetupHardware(); - V2Params_LoadEEPROMParamValues(); + V2Params_LoadNonVolatileParamValues(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); for (;;) - { + { Process_AVRISP_Commands(); - #if defined(ADC) - /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */ - V2Params_SetParameterValue(PARAM_VTARGET, ((5 * 10 * ADC_GetResult()) / 1024)); - #endif - + V2Params_UpdateParamValues(); + USB_USBTask(); } } @@ -117,20 +111,24 @@ void EVENT_USB_Device_ConfigurationChanged(void) } } -/** 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. */ +void Process_AVRISP_Commands(void) +{ /* Device must be connected and configured for the task to run */ if (USB_DeviceState != DEVICE_STATE_Configured) - return; - + return; + Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM); - - /* Check to see if a V2 Protocol command has been received - if not, abort */ - if (!(Endpoint_IsOUTReceived())) - return; - - /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */ - V2Protocol_ProcessCommand(); -} - + + /* Check to see if a V2 Protocol command has been received */ + if (Endpoint_IsOUTReceived()) + { + LEDs_SetAllLEDs(LEDMASK_BUSY); + + /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */ + V2Protocol_ProcessCommand(); + + LEDs_SetAllLEDs(LEDMASK_USB_READY); + } +} +