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