uputsnl(s);\r
\r
} else if (mode != 0) {\r
- \r
+ // CONFIG mode\r
unsigned position = 0;\r
char * ptr;\r
ptr = strtok(uart_string," ");\r
\r
\r
\r
- if (Command[0] == 1){\r
+ if (Command[0] == 0x6){\r
Command[0] = 0x60; // write\r
Command[3] = (Command[3]<<2) & 0xff;\r
- // <I2c Address> <Write:1> <Data15:0> <Data7:0> <RegAddress>\r
+ // <I2c Address> <Write:6> <Data15:0> <Data7:0> <RegAddress>\r
status2 = twi_writeTo(I2C_Address, Command, 4,1, true);\r
twi_readFrom(I2C_Address, &status, 1, true);\r
sprintf(s,"Status: 0x%x | Write Command: Data[15:8] 0x%x Data[7:0] 0x%x RegAddress: 0x%x",status[0], Command[1],Command[2],Command[3]);\r
uputsnl(s);\r
- } else {\r
- // <I2c Address> <Read:0> <RegAddress>\r
+ } else if (Command[0] == 0x5){\r
+ // <I2c Address> <Read:5> <RegAddress>\r
Command[0] = 0x50; // read\r
Command[1] = (Command[1]<<2) & 0xff;\r
- sprintf(s,"Status:0x%x | Send to reg: 0x%x",I2C_Address, Command[1]);\r
+ sprintf(s,"Addr:0x%x | Send to addr: 0x%x",I2C_Address, Command[1]);\r
uputsnl(s);\r
\r
twi_writeTo(I2C_Address, Command,2,1,true);\r
twi_readFrom(I2C_Address, &ReadReg, 3, true);\r
uint16_t Read = ReadReg[1]<<8 | ReadReg[2];\r
- sprintf(s,"Status: 0x%x | Read result: D[15:8] 0x%x D[7:0] 0x%x",ReadReg[0], ReadReg[1],ReadReg[2]);\r
+ sprintf(s,"Status: 0x%x | Read result: D[15:8] 0x%x D[7:0] 0x%x (reg: 0x%x, addr: 0x%x)",ReadReg[0], ReadReg[1],ReadReg[2],Command[1]>>2,Command[1]);\r
uputsnl(s);\r
+ } else if (Command[0] == 0xE){\r
+ // <I2c Address> <Store:E>\r
+ Command[0] = 0xE0; // read\r
+ sprintf(s,"Store volatile memory in non-volatile.");\r
+ uputsnl(s);\r
+ twi_writeTo(I2C_Address, Command,1,1,true);\r
}\r
\r
\r