forked from derekevans/W25Q16
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathW25Q16.h
45 lines (40 loc) · 1.03 KB
/
W25Q16.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
36
37
38
39
40
41
42
43
44
45
/*
W25Q16.h - Arduino library for communicating with the Winbond W25Q16 Serial Flash.
Created by Derek Evans, July 17, 2016.
*/
#ifndef W25Q16_h
#define W25Q16_h
#define WRITE_ENABLE 0x06
#define WRITE_DISABLE 0x04
#define PAGE_PROGRAM 0x02
#define READ_STATUS_REGISTER_1 0x05
#define READ_DATA 0x03
#define CHIP_ERASE 0xC7
#define POWER_DOWN 0xB9
#define RELEASE_POWER_DOWN 0xAB
#define MANUFACTURER_ID 0x90
#include "Arduino.h"
#include "SPI.h"
class W25Q16
{
public:
void init(int FLASH_SS);
void write(unsigned int page, byte pageAddress, byte val);
byte read(unsigned int page, byte pageAddress);
void initStreamWrite(unsigned int page, byte pageAddress);
void streamWrite(byte val);
void closeStreamWrite();
void initStreamRead(unsigned int page, byte pageAddress);
byte streamRead();
void closeStreamRead();
void powerDown();
void releasePowerDown();
void chipErase();
byte manufacturerID();
private:
void writeEnable();
void writeDisable();
void notBusy();
int _FLASH_SS;
};
#endif