Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BlackBoard_Firmware_Fast_read_not_test
Fork of Memory by
Diff: Memory.cpp
- Revision:
- 7:9d6961dcb7bb
- Parent:
- 6:c11cb6709b8b
diff -r c11cb6709b8b -r 9d6961dcb7bb Memory.cpp
--- a/Memory.cpp Thu Dec 22 22:16:11 2016 +0000
+++ b/Memory.cpp Thu Feb 09 01:09:28 2017 +0000
@@ -110,7 +110,7 @@
for(int i =0; i<length; i++) {
if(address%256==0) { //Handle start and end of pages
_cs_mem=1;
- wait_us(10);
+ wait_us(10);
//wait for the WIP bit to go low
_cs_mem=0; //Selet memory
my_spi.write(0x05); //Send read status register command
@@ -120,15 +120,19 @@
my_spi.write(0x05); //Send read status register command
byte1 = my_spi.write(dummy);//Send dummy byte to read status reg
}
+
+ //Select memory
_cs_mem=1;
-
+ wait_us(10);
_cs_mem=0; //Selet memory
+
my_spi.write(06); //Set Write Enable flag in the status reg
_cs_mem=1;
wait_us(10);
-
_cs_mem=0; //Selet memory
- my_spi.write(02); //Send read comand
+
+ //Write the destination address
+ my_spi.write(02); //Send Write comand
my_spi.write(address>>16); //Send high address byte
my_spi.write(address>>8); //Send middle adress byte
my_spi.write(address); //Send low address
