Cypress F-RAM FM25W256 library

Dependents:   Hello-FM25W256 Hello-FM25W256

FM25W256.h

Committer:
MACRUM
Date:
2016-03-04
Revision:
0:5a552209903c
Child:
1:bb2b1e4bfb6e

File content as of revision 0:5a552209903c:

#include "mbed.h"

#ifndef __FM25W256_HEAD__
#define __FM25W256_HEAD__

#define CMD_WREN   0x06
#define CMD_WRDI   0x04
#define CMD_RDSR   0x05
#define CMD_WRSR   0x01
#define CMD_READ   0x03
#define CMD_WRITE  0x02

class FM25W256 {
public:
    FM25W256(PinName mosi, PinName miso, PinName clk, PinName cs);
    FM25W256(SPI &spi, PinName cs);
    void write(uint16_t address, uint8_t data);
    void write(uint16_t address, uint8_t *data, uint16_t size);
    uint8_t read(uint16_t address);
    void read(uint16_t address, uint8_t *data, uint16_t size);

protected:
    SPI _spi;
    DigitalOut _cs;
};

#endif