Pass 2; commit 3/3;
This commit is contained in:
@@ -318,14 +318,16 @@ void WriteTagToFlash(uint8_t index, size_t size)
|
|||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||||
Flash_WriteEnable();
|
Flash_WriteEnable();
|
||||||
Flash_Erase4k(0,0);
|
Flash_Erase4k(0,0);
|
||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
|
||||||
Flash_WriteEnable();
|
|
||||||
|
|
||||||
uint32_t end_time;
|
uint32_t end_time;
|
||||||
uint32_t start_time = end_time = GetTickCount();
|
uint32_t start_time = end_time = GetTickCount();
|
||||||
|
|
||||||
while (bytes_remaining > 0)
|
while (bytes_remaining > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||||
|
Flash_WriteEnable();
|
||||||
|
|
||||||
uint32_t bytes_in_packet = MIN(FLASH_MEM_BLOCK_SIZE, bytes_remaining);
|
uint32_t bytes_in_packet = MIN(FLASH_MEM_BLOCK_SIZE, bytes_remaining);
|
||||||
|
|
||||||
memcpy(buff, data + bytes_sent, bytes_in_packet);
|
memcpy(buff, data + bytes_sent, bytes_in_packet);
|
||||||
|
|||||||
@@ -382,10 +382,6 @@ uint16_t Flash_WriteDataCont(uint32_t address, uint8_t *in, uint16_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
|
||||||
Flash_WriteEnable();
|
|
||||||
|
|
||||||
FlashSendByte(PAGEPROG);
|
FlashSendByte(PAGEPROG);
|
||||||
FlashSendByte((address >> 16) & 0xFF);
|
FlashSendByte((address >> 16) & 0xFF);
|
||||||
FlashSendByte((address >> 8) & 0xFF);
|
FlashSendByte((address >> 8) & 0xFF);
|
||||||
|
|||||||
Reference in New Issue
Block a user