- UsbCommand c = {CMD_PCF7931_WRITE, { blockaddress, byteaddress, data} };
- memcpy(c.d.asDwords, configPcf.Pwd, 7);
- c.d.asDwords[7] = (configPcf.Offset[0]+128);
- c.d.asDwords[8] = (configPcf.Offset[1]+128);
+ data = param_get8ex(Cmd, 2, 0, 16);
+
+ PrintAndLog("Writing block: %d", block);
+ PrintAndLog(" pos: %d", bytepos);
+ PrintAndLog(" data: 0x%02X", data);
+
+ UsbCommand c = {CMD_PCF7931_WRITE, { block, bytepos, data} };
+ memcpy(c.d.asDwords, configPcf.Pwd, sizeof(configPcf.Pwd) );
+ c.d.asDwords[7] = (configPcf.OffsetWidth + 128);
+ c.d.asDwords[8] = (configPcf.OffsetPosition + 128);