mirror of https://github.com/ARMmbed/mbed-os.git
Fix write_enable commands and method.
-This only has effect if sector protection enabled.pull/7774/head
parent
9ee3f5afa7
commit
ba46863c42
|
@ -60,8 +60,8 @@ enum opcode {
|
|||
|
||||
/* non-exhaustive command list */
|
||||
enum command {
|
||||
DATAFLASH_COMMAND_WRITE_DISABLE = 0x3D2A7F9A,
|
||||
DATAFLASH_COMMAND_WRITE_ENABLE = 0x3D2A7FA9,
|
||||
DATAFLASH_COMMAND_WRITE_DISABLE = 0x3D2A7FA9,
|
||||
DATAFLASH_COMMAND_WRITE_ENABLE = 0x3D2A7F9A,
|
||||
DATAFLASH_COMMAND_BINARY_PAGE_SIZE = 0x3D2A80A6,
|
||||
DATAFLASH_COMMAND_DATAFLASH_PAGE_SIZE = 0x3D2A80A7,
|
||||
};
|
||||
|
@ -525,22 +525,20 @@ void DataFlashBlockDevice::_write_enable(bool enable)
|
|||
|
||||
/* enable writing, disable write protection */
|
||||
if (enable) {
|
||||
/* if not-write-protected pin is connected, select it */
|
||||
if (_nwp.is_connected()) {
|
||||
_nwp = 1;
|
||||
}
|
||||
|
||||
/* send 4 byte command enabling writes */
|
||||
_write_command(DATAFLASH_COMMAND_WRITE_ENABLE, NULL, 0);
|
||||
} else {
|
||||
|
||||
/* if not-write-protected pin is connected, deselect it */
|
||||
if (_nwp.is_connected()) {
|
||||
_nwp = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* if not-write-protected pin is connected, select it */
|
||||
if (_nwp.is_connected()) {
|
||||
_nwp = 1;
|
||||
}
|
||||
|
||||
/* send 4 byte command disabling writes */
|
||||
_write_command(DATAFLASH_COMMAND_WRITE_DISABLE, NULL, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue