mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #8483 from paul-szczepanek-arm/eeprom-fix
BLE: write size first when writing an eeprom messagepull/8503/head
commit
ecb6e6effb
|
@ -126,8 +126,8 @@ private:
|
||||||
nfc_eeprom_idle,
|
nfc_eeprom_idle,
|
||||||
|
|
||||||
nfc_eeprom_write_start_session,
|
nfc_eeprom_write_start_session,
|
||||||
nfc_eeprom_write_write_bytes,
|
|
||||||
nfc_eeprom_write_write_size,
|
nfc_eeprom_write_write_size,
|
||||||
|
nfc_eeprom_write_write_bytes,
|
||||||
nfc_eeprom_write_end_session,
|
nfc_eeprom_write_end_session,
|
||||||
|
|
||||||
nfc_eeprom_read_start_session,
|
nfc_eeprom_read_start_session,
|
||||||
|
|
|
@ -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
|
handle_error(NFC_ERR_CONTROLLER); // An EEPROM is not really a controller but close enough
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_current_op = nfc_eeprom_write_write_bytes;
|
_current_op = nfc_eeprom_write_write_size;
|
||||||
continue_write();
|
_driver->write_size(ac_buffer_reader_readable(&_ndef_buffer_reader));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nfc_eeprom_read_start_session:
|
case nfc_eeprom_read_start_session:
|
||||||
|
@ -272,10 +272,8 @@ void NFCEEPROM::on_size_written(bool success)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// End session
|
_current_op = nfc_eeprom_write_write_bytes;
|
||||||
_current_op = nfc_eeprom_write_end_session;
|
continue_write();
|
||||||
_operation_result = NFC_OK;
|
|
||||||
_driver->end_session();
|
|
||||||
break;
|
break;
|
||||||
case nfc_eeprom_erase_write_max_size:
|
case nfc_eeprom_erase_write_max_size:
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
@ -371,9 +369,10 @@ void NFCEEPROM::continue_write()
|
||||||
// Continue writing
|
// 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));
|
_driver->write_bytes(_eeprom_address, ac_buffer_reader_current_buffer_pointer(&_ndef_buffer_reader), ac_buffer_reader_current_buffer_length(&_ndef_buffer_reader));
|
||||||
} else {
|
} else {
|
||||||
// Now update size
|
// we are done
|
||||||
_current_op = nfc_eeprom_write_write_size;
|
_current_op = nfc_eeprom_write_end_session;
|
||||||
_driver->write_size(_eeprom_address);
|
_operation_result = NFC_OK;
|
||||||
|
_driver->end_session();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue