- 기존 bit-bang 방식, SPI 핀(P0.14/15/16)이 하드웨어 SPIM 모드로 잡혀있어 GPIO 제어 불가 - CS만 GPIO로 분리 제어(ADA2200, W25Q32)
40 lines
1.4 KiB
C
40 lines
1.4 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 (GPIO manual control) */
|
|
/* SCK/MOSI/MISO are shared with ADA2200 via spi2_bus (P0.14/P0.16/P0.15) */
|
|
|
|
/* 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 */
|