Remove dependancies from the LowLevel demos to the ClassDriver demos, since the use...
[pub/USBasp.git] / Projects / AVRISP / Lib / V2ProtocolParams.c
index 9914c08..6aaa955 100644 (file)
@@ -85,17 +85,30 @@ static ParameterItem_t ParameterTable[] =
 \r
 \r
 /** Loads saved non-volatile parameter values from the EEPROM into the parameter table, as needed. */\r
-void V2Params_LoadEEPROMParamValues(void)\r
+void V2Params_LoadNonVolatileParamValues(void)\r
 {\r
-       /* Target RESET line polarity is a non-volatile value, retrieve current parameter value from EEPROM */\r
+       /* Target RESET line polarity is a non-volatile value, retrieve current parameter value from EEPROM -\r
+        *   NB: Cannot call V2Protocol_SetParameterValue() here, as that will cause another EEPROM write!\r
+        */\r
        V2Params_GetParamFromTable(PARAM_RESET_POLARITY)->ParamValue = eeprom_read_byte(&EEPROM_Rest_Polarity);\r
 }\r
 \r
+/** Updates any parameter values that are sourced from hardware rather than explicitly set by the host, such as\r
+ *  VTARGET levels from the ADC on supported AVR models.\r
+ */\r
+void V2Params_UpdateParamValues(void)\r
+{\r
+       #if defined(ADC)\r
+       /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */\r
+       V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = ((5 * 10 * ADC_GetResult()) / 1024);\r
+       #endif\r
+}\r
+\r
 /** Retrieves the host PC read/write privellages for a given parameter in the parameter table. This should\r
  *  be called before calls to \ref V2Params_GetParameterValue() or \ref V2Params_SetParameterValue() when\r
  *  getting or setting parameter values in response to requests from the host.\r
  *\r
- *  \param ParamID  Parameter ID whose privellages are to be retrieved from the table\r
+ *  \param[in] ParamID  Parameter ID whose privellages are to be retrieved from the table\r
  *\r
  *  \return Privellages for the requested parameter, as a mask of PARAM_PRIV_* masks\r
  */ \r
@@ -111,7 +124,7 @@ uint8_t V2Params_GetParameterPrivellages(uint8_t ParamID)
 \r
 /** Retrieves the current value for a given parameter in the parameter table.\r
  *\r
- *  \param ParamID  Parameter ID whose value is to be retrieved from the table\r
+ *  \param[in] ParamID  Parameter ID whose value is to be retrieved from the table\r
  *\r
  *  \return Current value of the parameter in the table, or 0 if not found\r
  */ \r
@@ -127,8 +140,8 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID)
 \r
 /** Sets the value for a given parameter in the parameter table.\r
  *\r
- *  \param ParamID  Parameter ID whose value is to be set in the table\r
- *  \param Value  New value to set the parameter to\r
+ *  \param[in] ParamID  Parameter ID whose value is to be set in the table\r
+ *  \param[in] Value  New value to set the parameter to\r
  *\r
  *  \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise\r
  */\r
@@ -149,7 +162,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
 /** Retrieves a parameter entry (including ID, value and privellages) from the parameter table that matches the given\r
  *  parameter ID.\r
  *\r
- *  \param ParamID  Parameter ID to find in the table\r
+ *  \param[in] ParamID  Parameter ID to find in the table\r
  *\r
  *  \return Pointer to the associated parameter information from the parameter table if found, NULL otherwise\r
  */\r