AVRISP-MKII Clone Programmer Project

Data Structures | Macros | Functions
V2ProtocolParams.h File Reference
`#include <avr/io.h>`
`#include <avr/eeprom.h>`
`#include "V2Protocol.h"`
`#include "V2ProtocolConstants.h"`
`#include "ISP/ISPTarget.h"`
`#include "Config/AppConfig.h"`

## Data Structures

struct | ParameterItem_t

## Macros

#define | PARAM_PRIV_READ (1 << 0)
#define | PARAM_PRIV_WRITE (1 << 1)
#define | TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
#define | FIRMWARE_VERSION_MINOR 0x18

## Functions

void | V2Params_LoadNonVolatileParamValues (void)
void | V2Params_UpdateParamValues (void)
uint8_t | V2Params_GetParameterPrivileges (const uint8_t ParamID)
uint8_t | V2Params_GetParameterValue (const uint8_t ParamID)
void | V2Params_SetParameterValue (const uint8_t ParamID, const uint8_t Value)

## Detailed Description

Header file for V2ProtocolParams.c.

## Macro Definition Documentation

## § FIRMWARE_VERSION_MINOR

#define FIRMWARE_VERSION_MINOR 0x18

Minor firmware version, reported to the host on request; must match the version the host is expecting, or it (may) reject further communications with the programmer.

## § PARAM_PRIV_READ

#define PARAM_PRIV_READ (1 << 0)

Parameter privilege mask to allow the host PC to read the parameter's value.

## § PARAM_PRIV_WRITE

#define PARAM_PRIV_WRITE (1 << 1)

Parameter privilege mask to allow the host PC to change the parameter's value.

## § TABLE_PARAM_COUNT

#define TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))

Total number of parameters in the parameter table

## Function Documentation

## § V2Params_GetParameterPrivileges()

uint8_t V2Params_GetParameterPrivileges | ( | const uint8_t | ParamID | ) |

Retrieves the host PC read/write privileges for a given parameter in the parameter table. This should be called before calls to V2Params_GetParameterValue() or V2Params_SetParameterValue() when getting or setting parameter values in response to requests from the host.

Parameters

  [in] | ParamID | Parameter ID whose privileges are to be retrieved from the table

Returns
  Privileges for the requested parameter, as a mask of `PARAM_PRIV_*` masks

## § V2Params_GetParameterValue()

uint8_t V2Params_GetParameterValue | ( | const uint8_t | ParamID | ) |

Retrieves the current value for a given parameter in the parameter table.

Note
  This function does not first check for read privileges - if the value is being sent to the host via a GET PARAM command, V2Params_GetParameterPrivileges() should be called first to ensure that the parameter is host-readable.

Parameters

  [in] | ParamID | Parameter ID whose value is to be retrieved from the table

Returns
  Current value of the parameter in the table, or 0 if not found

## § V2Params_LoadNonVolatileParamValues()

void V2Params_LoadNonVolatileParamValues | ( | void |  | ) |

Loads saved non-volatile parameter values from the EEPROM into the parameter table, as needed.

## § V2Params_SetParameterValue()

void V2Params_SetParameterValue | ( | const uint8_t | ParamID,
|  | const uint8_t | Value
| ) |  |

Sets the value for a given parameter in the parameter table.

Note
  This function does not first check for write privileges - if the value is being sourced from the host via a SET PARAM command, V2Params_GetParameterPrivileges() should be called first to ensure that the parameter is host-writable.

Parameters

  [in] | ParamID | Parameter ID whose value is to be set in the table
  [in] | Value | New value to set the parameter to

Returns
  Pointer to the associated parameter information from the parameter table if found, NULL otherwise

## § V2Params_UpdateParamValues()

void V2Params_UpdateParamValues | ( | void |  | ) |

Updates any parameter values that are sourced from hardware rather than explicitly set by the host, such as VTARGET levels from the ADC on supported AVR models.