Serial flash memory, binary access
Dependents: S25FL216K_USBFileSystem SPItest S25FL216K_USBFileSystem S25FL216K_FATFileSystem
S25FL216K.h
- Committer:
- Sissors
- Date:
- 2013-07-20
- Revision:
- 0:3cb41d985302
- Child:
- 1:2bcefc9e64f8
File content as of revision 0:3cb41d985302:
#ifndef S25FL216K_H #define S25FL216K_H #include "mbed.h" #define S25FL_WRITE_STATUS 0x01 #define S25FL216K_WRITE 0x02 #define S25FL216K_READ 0x03 #define S25FL216K_RDSR 0x05 #define S25FL216K_WREN 0x06 #define S25FL216K_SECTOR_ERASE 0x20 #define S25FL216K_CHIP_ERASE 0xC7 #define S25FL216K_BLOCK_ERASE 0xD8 #define S25FL216K_JEDEC 0x9F class S25FL216K { public: S25FL216K(PinName mosi, PinName miso, PinName sclk, PinName cs); /* Checks if communication with the device functions * * @return - true upon succesfull communication, false if it failed */ bool testConnection( void ); void read(int address, char *buffer, int length); void write(int address, char *buffer, int length, bool block = true); void eraseSector(int address, bool block = true); void eraseBlock(int address, bool block = true); void eraseChip(bool block = true); char getStatus( void ); void setWriteEnable( void ); bool isBusy( void ); private: SPI _spi; DigitalOut _cs; }; #endif