The "enable write status" command has to be sent before "write status" command to unlock memory area.
Fork of SST25VF by
main.cpp
- Committer:
- emmibed
- Date:
- 2012-01-15
- Revision:
- 0:1633dfa4b768
File content as of revision 0:1633dfa4b768:
#include "mbed.h" #include "SST25VF.h" #define w() wait_us(7) DigitalOut sr(p21); SPI spi(p5,p6,p7); SST25VF sram(spi,p21); int main() { char buff[128]; wait(0.2); sram.write((long) 0, 'o'); sram.write((long)1, 'n'); sram.write((long)2, 'e'); sram.write((long)3, '\0'); for (long int address = 0; address < 4; address++) { buff[address] = sram.read(address); } printf("\noutput1 = %s\n", buff); sram.write((long)128, "Hello world!",12); // need separate address space here sram.read((long)128, buff, 12); buff[12]='\0'; printf("output2 = %s\n", buff); }