8#include "entryPointCPP.hpp"
9#include "W25QFlashSPI.hpp"
10#include "w25q_validation.hpp"
17static bool w25qReady =
false;
19void initW25QFlash(
void) {
21 w25qReady = w25qFlash->
Init();
24bool w25qIsReady(
void) {
28bool w25qReadBuffer(uint32_t addr, uint8_t *buf, uint32_t len) {
29 if (w25qFlash ==
nullptr || !w25qReady) {
32 bool value = w25qFlash->
readBuffer(addr, buf, len);
36bool w25qWriteBuffer(uint32_t addr,
const uint8_t *data, uint32_t len) {
37 if (w25qFlash ==
nullptr || !w25qReady) {
40 bool value = w25qFlash->
writeBuffer(addr, data, len);
44bool w25qEraseSector(uint32_t addr) {
45 if (w25qFlash ==
nullptr || !w25qReady) {
52bool w25qReadJEDECID(uint32_t *
id) {
53 if (w25qFlash ==
nullptr || !w25qReady) {
60void w25qRunValidation(
void) {
61 if (w25qFlash ==
nullptr || !w25qReady) {
62 printf(
"W25Q validation skipped -- flash not initialized\r\n");
STM32 HAL SPI1 driver for a Winbond W25Q-series flash chip (Adafruit 5632/5633/5634),...
bool eraseSector(uint32_t addr)
Erases the single 4KB sector containing the given address.
bool Init()
Resets the chip and verifies communication via the JEDEC ID.
bool readBuffer(uint32_t addr, uint8_t *buf, uint32_t len)
Reads len bytes starting at addr into buf.
bool writeBuffer(uint32_t addr, const uint8_t *data, uint32_t len)
Writes len bytes starting at addr, paging internally at 256-byte boundaries as the chip's Page Progra...
bool readJEDECID(uint32_t &id)
Reads the 3-byte JEDEC ID (manufacturer, memory type, capacity).
Destructive validation suite for a W25QFlashSPI driver – see w25q_validation.hpp's file header for th...