forked from sdjngyq/MFDLCD18_H
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPI_RAM.h
35 lines (28 loc) · 819 Bytes
/
SPI_RAM.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef __SPI_RAM_H_
#define __SPI_RAM_H_
//data
#define BYTE unsigned char
#define WORD unsigned short
// SRAM opcodes
#define CMD_WREN 0x06
#define CMD_WRDI 0x04
#define CMD_RDSR 0x05
#define CMD_WRSR 0x01
#define CMD_READ 0x03
#define CMD_WRITE 0x02
// SRAM modes
#define BYTE_MODE 0x00
#define PAGE_MODE 0x80
#define STREAM_MODE 0x40
class SPIRAM{
public:
void SPIRAM_SPI_Init(void);
void SPIRAM_Set_Mode(BYTE mode);
BYTE SPIRAM_RD_Byte(WORD Addr);
void SPIRAM_WR_Byte(WORD Addr, BYTE Data);
void SPIRAM_RD_Page(WORD Addr, BYTE *pBuf);
void SPIRAM_WR_Page(WORD Addr, BYTE *pBuf);
void SPIRAM_RD_Stream(WORD Addr, BYTE *pBuf, unsigned long Len);
void SPIRAM_WR_Stream(WORD Addr, BYTE *pBuf, unsigned long Len);
};
#endif