Skip to content

Commit

Permalink
write size first
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-szczepanek-arm committed Oct 19, 2018
1 parent e942582 commit d5edd3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion features/nfc/nfc/NFCEEPROM.h
Expand Up @@ -126,8 +126,8 @@ class NFCEEPROM : public NFCTarget, public NFCEEPROMDriver::Delegate {
nfc_eeprom_idle,

nfc_eeprom_write_start_session,
nfc_eeprom_write_write_bytes,
nfc_eeprom_write_write_size,
nfc_eeprom_write_write_bytes,
nfc_eeprom_write_end_session,

nfc_eeprom_read_start_session,
Expand Down
17 changes: 8 additions & 9 deletions features/nfc/source/nfc/NFCEEPROM.cpp
Expand Up @@ -138,8 +138,8 @@ void NFCEEPROM::on_session_started(bool success)
handle_error(NFC_ERR_CONTROLLER); // An EEPROM is not really a controller but close enough
return;
}
_current_op = nfc_eeprom_write_write_bytes;
continue_write();
_current_op = nfc_eeprom_write_write_size;
_driver->write_size(ac_buffer_reader_readable(&_ndef_buffer_reader));
break;

case nfc_eeprom_read_start_session:
Expand Down Expand Up @@ -272,10 +272,8 @@ void NFCEEPROM::on_size_written(bool success)
return;
}

// End session
_current_op = nfc_eeprom_write_end_session;
_operation_result = NFC_OK;
_driver->end_session();
_current_op = nfc_eeprom_write_write_bytes;
continue_write();
break;
case nfc_eeprom_erase_write_max_size:
if (!success) {
Expand Down Expand Up @@ -371,9 +369,10 @@ void NFCEEPROM::continue_write()
// Continue writing
_driver->write_bytes(_eeprom_address, ac_buffer_reader_current_buffer_pointer(&_ndef_buffer_reader), ac_buffer_reader_current_buffer_length(&_ndef_buffer_reader));
} else {
// Now update size
_current_op = nfc_eeprom_write_write_size;
_driver->write_size(_eeprom_address);
// we are done
_current_op = nfc_eeprom_write_end_session;
_operation_result = NFC_OK;
_driver->end_session();
}
}

Expand Down

1 comment on commit d5edd3f

@ConradBraam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test code no longer reproduces the issue, good from my side

Please sign in to comment.