#define INCLUDE_FROM_V2PROTOCOL_C\r
#include "V2Protocol.h"\r
\r
+uint32_t CurrentAddress;\r
+\r
+\r
/* Table of masks for SPI_Init() from a given PARAM_SCK_DURATION value */\r
static const uint8_t SPIMaskFromSCKDuration[MAX_SPI_SETTINGS] =\r
{\r
case CMD_GET_PARAMETER:\r
V2Protocol_Command_GetSetParam(V2Command);\r
break;\r
+ case CMD_LOAD_ADDRESS:\r
+ V2Protocol_Command_LoadAddress();\r
+ break;\r
case CMD_SPI_MULTI:\r
V2Protocol_Command_SPIMulti();\r
break; \r
Endpoint_WaitUntilReady();\r
\r
V2Protocol_ReconfigureSPI();\r
+ CurrentAddress = 0;\r
\r
Endpoint_Write_Byte(CMD_SIGN_ON);\r
Endpoint_Write_Byte(STATUS_CMD_OK);\r
Endpoint_ClearIN();\r
}\r
\r
+static void V2Protocol_Command_LoadAddress(void)\r
+{\r
+ CurrentAddress = Endpoint_Read_DWord_LE();\r
+\r
+ Endpoint_ClearOUT();\r
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
+ Endpoint_WaitUntilReady();\r
+\r
+ Endpoint_Write_Byte(CMD_LOAD_ADDRESS);\r
+ Endpoint_Write_Byte(STATUS_CMD_OK);\r
+ Endpoint_ClearIN();\r
+}\r
+\r
static void V2Protocol_Command_SPIMulti(void)\r
{\r
uint8_t TxBytes = Endpoint_Read_Byte();\r