fixed block transfer for OTA LUT and NFC

This commit is contained in:
jjwbruijn
2023-05-24 00:08:50 +02:00
parent a888991ecc
commit 7b081431de
8 changed files with 18 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
zbs243_Tag_FW/i2cdevices.h Normal file → Executable file
View File

@@ -6,5 +6,6 @@ bool supportsNFCWake();
void loadURLtoNTag();
void loadRawNTag(uint16_t blocksize);
bool i2cCheckDevice(uint8_t address);
void i2cBusScan();
#endif

View File

@@ -180,6 +180,9 @@ void main() {
pr("BOOTED> %d.%d.%d%s\n", fwVersion / 100, (fwVersion % 100) / 10, (fwVersion % 10), fwVersionSuffix);
powerUp(INIT_I2C);
//i2cBusScan();
if (i2cCheckDevice(0x55)) {
powerDown(INIT_I2C);
capabilities |= CAPABILITY_HAS_NFC;

View File

@@ -822,15 +822,14 @@ bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) {
powerDown(INIT_RADIO);
return true;
}
curBlock.blockId = 0;
xMemCopy8(&(curBlock.ver), &(avail->dataVer));
curBlock.type = avail->dataType;
xMemCopyShort(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
uint16_t __xdata nfcsize = avail->dataSize;
wdt10s();
if (getDataBlock(avail->dataSize)) {
powerUp(INIT_RADIO);
sendXferComplete();
powerDown(INIT_RADIO);
curDataInfo.dataSize = 0; // mark as transfer not pending
powerUp(INIT_I2C);
if (avail->dataType == DATATYPE_NFC_URL_DIRECT) {
// only one URL (handle NDEF records on the tag)
@@ -839,7 +838,11 @@ bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) {
// raw NFC data upload to the NFC IC
loadRawNTag(nfcsize);
}
timerDelay(13330);
powerDown(INIT_I2C);
powerUp(INIT_RADIO);
sendXferComplete();
powerDown(INIT_RADIO);
return true;
}
return false;
@@ -864,14 +867,17 @@ bool processAvailDataInfo(struct AvailDataInfo *__xdata avail) {
powerDown(INIT_RADIO);
return true;
}
curBlock.blockId = 0;
xMemCopy8(&(curBlock.ver), &(avail->dataVer));
curBlock.type = avail->dataType;
xMemCopyShort(&curDataInfo, (void *)avail, sizeof(struct AvailDataInfo));
wdt10s();
if (getDataBlock(avail->dataSize)) {
curDataInfo.dataSize = 0; // mark as transfer not pending
memcpy(customLUT, sizeof(struct blockData) + blockXferBuffer, dispLutSize * 10);
powerUp(INIT_RADIO);
sendXferComplete();
powerDown(INIT_RADIO);
curDataInfo.dataSize = 0; // mark as transfer not pending
memcpy(customLUT, sizeof(struct blockData) + blockXferBuffer, dispLutSize * 10);
return true;
}
#endif