AVRISP-MKII Clone Programmer Project

Functions | Variables
V2ProtocolParams.c File Reference
`#include "V2ProtocolParams.h"`

## 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)
static ParameterItem_t *const | V2Params_GetParamFromTable (const uint8_t ParamID)

## Variables

static uint8_t EEMEM | EEPROM_Reset_Polarity = 0x01
static uint8_t EEMEM | EEPROM_SCK_Duration = 0x06
static ParameterItem_t | ParameterTable []

## Detailed Description

V2Protocol parameter handler, to process V2 Protocol device parameters.

## 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_GetParamFromTable()

static ParameterItem_t* const V2Params_GetParamFromTable | ( | const uint8_t | ParamID | ) |

static

Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given parameter ID.

Parameters

  [in] | ParamID | Parameter ID to find in the table

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

## § 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.

## Variable Documentation

## § EEPROM_Reset_Polarity

uint8_t EEMEM EEPROM_Reset_Polarity = 0x01

static

## § EEPROM_SCK_Duration

uint8_t EEMEM EEPROM_SCK_Duration = 0x06

static

## § ParameterTable

ParameterItem_t ParameterTable[]

static