diff --git a/src/W25QXXArduino/w25qxx.h b/src/W25QXXArduino/w25qxx.h index bd07dfa..930ebbc 100644 --- a/src/W25QXXArduino/w25qxx.h +++ b/src/W25QXXArduino/w25qxx.h @@ -31,28 +31,33 @@ extern uint16_t W25QXX_TYPE; // #define W25QXX_CS1 digitalWrite(NORFLASH_CS_PIN, HIGH) /////////////////////////////////////////////////////////////////////////// -//端口定义 -#define ESP32S3 - -#ifdef ESP32 //choose ESP32 - #define NORFLASH_CS_PIN 5 - #define NORFLASH_CLK_PIN 18 - #define NORFLASH_MOSI_PIN 23 - #define NORFLASH_MISO_PIN 19 -#endif -#ifdef ESP32S3 //choose ESP32S3 - #define NORFLASH_CS_PIN 10 - #define NORFLASH_CLK_PIN 12 - #define NORFLASH_MOSI_PIN 11 - #define NORFLASH_MISO_PIN 13 -#endif -////////////////////////////////////////////////////////////////////////// //SPI相关设定 #define SPI_FREQUENCY 30*1000000 //SPI时钟频率,硬件SPI使用 // #define HARDWARE_SPI //使用硬件SPI #define SOFTWARE_SPI //使用软件SPI #define FLASH_TEST_ENABLE //使能测试 -////////////////////////////////////////////////////////////////////////// +//端口定义 +#ifdef HARDWARE_SPI + #define ESP32S3 + #ifdef ESP32 //choose ESP32 + #define NORFLASH_CS_PIN 5 + #define NORFLASH_CLK_PIN 18 + #define NORFLASH_MOSI_PIN 23 + #define NORFLASH_MISO_PIN 19 + #endif + #ifdef ESP32S3 //choose ESP32S3 + #define NORFLASH_CS_PIN 10 + #define NORFLASH_CLK_PIN 12 + #define NORFLASH_MOSI_PIN 11 + #define NORFLASH_MISO_PIN 13 + #endif +#endif +#ifdef SOFTWARE_SPI + #define NORFLASH_CS_PIN 10 + #define NORFLASH_CLK_PIN 12 + #define NORFLASH_MOSI_PIN 11 + #define NORFLASH_MISO_PIN 14 +#endif ////////////////////////////////////////////////////////////////////////// //指令表