Chr Doerr / Mbed 2 deprecated 23LC1024

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers 23LCV1024.h Source File

23LCV1024.h

00001 #include "mbed.h"
00002 
00003 
00004 #define CMD_READ    0x03
00005 #define CMD_WRITE   0x02
00006 #define CMD_RDMR    0x05
00007 #define CMD_WRMR    0x01
00008 
00009 
00010 // The 23LCV1024 is a 1 Mbit Serial SRAM, with 128K * 8 bits organized into 32 byte pages
00011 // A 24 bit address, 00000h - 1FFFFh, is used to address the memory location
00012 
00013 // In this library, we will address the memory in blocks of 256 bytes, of which there are 512 in total
00014 // (2^1) (2^8 = 256 blocks) (2^8 = 256 bytes)
00015 // 512 blocks a 256 bytes
00016 
00017 
00018 class SRAM23LCV1024 {
00019     public:
00020         SRAM23LCV1024(SPI& spi, PinName cs);
00021     
00022         int getReadMode();
00023         
00024         int readBytes(int address, char* buffer, int length);
00025         int writeBytes(int address, char* buffer, int length);
00026         
00027     private:
00028         SPI& _spi;
00029         DigitalOut _cs;   
00030 };