42 lines
1.6 KiB
C
42 lines
1.6 KiB
C
/*******************************************************************************
|
|
* @file w25q32.h
|
|
* @brief W25Q32RV External SPI Flash Driver (Simplified)
|
|
******************************************************************************/
|
|
|
|
#ifndef W25Q32_H
|
|
#define W25Q32_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/*==============================================================================
|
|
* PIN CONFIGURATION - VivaMayo hardware
|
|
*============================================================================*/
|
|
|
|
#define W25Q_CS_PIN 24 /* P0.24 - Chip Select */
|
|
#define W25Q_SCK_PIN 14 /* P0.14 - Clock (shared with ADA2200) */
|
|
#define W25Q_MOSI_PIN 16 /* P0.16 - Master Out (shared with ADA2200) */
|
|
#define W25Q_MISO_PIN 19 /* P0.19 - Master In (dedicated, avoid ADA2200 conflict) */
|
|
|
|
/* Power control pins - both HIGH = W25Q32 power ON */
|
|
#define W25Q_PWR_PIN1 1 /* P0.01 - W25Q32 dedicated */
|
|
#define W25Q_PWR_PIN2 11 /* P0.11 - W25Q32 dedicated */
|
|
|
|
/*==============================================================================
|
|
* API FUNCTIONS
|
|
*============================================================================*/
|
|
|
|
void w25q32_power_on(void);
|
|
void w25q32_power_off(void);
|
|
bool w25q32_init(void);
|
|
bool w25q32_check_jedec(void);
|
|
#define w25q32_check_id w25q32_check_jedec /* Legacy alias */
|
|
|
|
void w25q32_read(uint32_t addr, uint8_t *buf, uint32_t len);
|
|
void w25q32_write(uint32_t addr, const uint8_t *buf, uint32_t len);
|
|
|
|
void w25q32_sector_erase(uint32_t addr);
|
|
void w25q32_chip_erase(void);
|
|
|
|
#endif /* W25Q32_H */
|