#ifndef __FLASH_H_ #define __FLASH_H_ #include "define.h" #define FLASH_CS_ENABLE nrf_gpio_pin_write(FLASH_SS_PIN, 0); #define FLASH_CS_DISABLE nrf_gpio_pin_write(FLASH_SS_PIN, 1); #define Flash_Secpos_Size 4096 #define FLASH_SYS_IDX 0 #define FLASH_DEV_IDX 1 #define FLASH_ALARM_IDX 256 #define FLASH_ALARM_SIZE 4096 #define FLASH_ALARM_LEN 256 //W25X32 #define Flash_ID1 0xEF16 //w25q64的ID //指令表 #define Flash_Instruct_WriteEnable 0x06 //写使能 #define Flash_Instruct_WriteDisable 0x04 //写禁止 #define Flash_Instruct_ReadStatusReg 0x05 //读状态寄存器 #define Flash_Instruct_WriteStatusReg 0x01 //写状态寄存器 #define Flash_Instruct_ReadData 0x03 //读数据 #define Flash_Instruct_FastReadData 0x0B //快速读数据 #define Flash_Instruct_FastReadDual 0x3B //双倍快速读数据 #define Flash_Instruct_PageProgram 0x02 //页编程 #define Flash_Instruct_BlockErase 0xD8 //块擦除64K #define Flash_Instruct_SectorErase 0x20 //扇区擦除 #define Flash_Instruct_ChipErase 0xC7 //全片擦除 #define Flash_Instruct_PowerDown 0xB9 //低功耗 #define Flash_Instruct_ReleasePowerDown 0xAB //唤醒 #define Flash_Instruct_DeviceID 0xAB //芯片ID #define Flash_Instruct_ManufactDeviceID 0x90 //芯片ID #define Flash_Instruct_JedecDeviceID 0x9F //JEDEC ID #define Flash_Instruct_UniqueID 0x4B //Unique ID typedef enum { FLASH_QUEUE_TIME=0, FLASH_QUEUE_INT=1, FLASH_QUEUE_BUSY=2, }FLASH_QUEUE_TYPE; typedef enum { FLASH_BUSY, FLASH_ENABLE, FLASH_DISABLE }FLASH_STAT; typedef enum { FLASH_WRITE, FLASH_READ, FLASH_UNIQUEID, //读取UniqueID FLASH_MDID, //读取ManufactDeviceID FLASH_SLEEP, FLASH_WAKEUP, FLASH_DELAY, }FLASH_WORK; typedef struct{ FLASH_WORK flash_work; FLASH_STAT flash_stat; }FLASH_STRUCT; void Flash_Gpio_Init(void); #endif