16#define W25Q128_PAGE_PROGRAM 0x02
17#define W25Q128_READ_DATA 0x03
18#define W25Q128_WRITE_ENABLE 0x06
19#define W25Q128_ERASE_CHIP 0x60
20#define W25Q128_READ_STATUS_REGISTER_1 0x05
21#define W25Q128_READ_STATUS_REGISTER_2 0x35
22#define W25Q128_READ_STATUS_REGISTER_3 0x15
24#define W25Q128_PAGE_SIZE 256
25#define W25Q128_PAGE_COUNT 65536
33typedef struct W25Q128 {
44void _W25Q128_readStatus1(
W25Q128_t *, uint8_t *);
45void _W25Q128_readStatus2(
W25Q128_t *, uint8_t *);
46void _W25Q128_readStatus3(
W25Q128_t *, uint8_t *);
Defines the API for Flash memory storage.
GPIOpin_t cs
Chip select GPIO.
SPI_t * spi
Parent SPI interface.
Struct definition for a GPIO pin.
Struct definition for SPI interface. Provides the interface for API consumers to interact with the SP...
void W25Q128_writePage(Flash_t *, uint32_t, uint8_t *)
Write page to flash.
void W25Q128_readPage(Flash_t *, uint32_t, volatile uint8_t *)
Read from flash.
W25Q128_t W25Q128_init(W25Q128_t *, SPI_t *, GPIOpin_t)
Initialise flash struct.
void W25Q128_erase(Flash_t *)
Erase flash chip.