* the project and is responsible for the initial application hardware configuration.\r
*/\r
\r
-// TODO: Add in software SPI for lower programming speeds below 125KHz\r
-// TODO: Add reversed target connector checks\r
-\r
#include "AVRISP.h"\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
{\r
SetupHardware();\r
\r
- V2Params_LoadEEPROMParamValues();\r
+ V2Params_LoadNonVolatileParamValues();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
\r
for (;;)\r
- {
+ {\r
Process_AVRISP_Commands();\r
\r
- #if defined(ADC)\r
- /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */\r
- V2Params_SetParameterValue(PARAM_VTARGET, ((5 * 10 * ADC_GetResult()) / 1024));\r
- #endif
-\r
+ V2Params_UpdateParamValues();\r
+ \r
USB_USBTask();\r
}\r
}\r
ADC_StartReading(VTARGET_ADC_CHANNEL | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);\r
#endif\r
\r
- /* Millisecond timer initialization for timeout checking */\r
+ /* Millisecond timer initialization for timeouts and delays */\r
OCR0A = ((F_CPU / 64) / 1000);\r
TCCR0A = (1 << WGM01);\r
TCCR0B = ((1 << CS01) | (1 << CS00));\r
}\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 - if not, abort */
- if (!(Endpoint_IsOUTReceived()))
- return;
-
- /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
- V2Protocol_ProcessCommand();\r
-}
-
+ \r
+ /* Check to see if a V2 Protocol command has been received */\r
+ if (Endpoint_IsOUTReceived())\r
+ {\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