31 #define U_ID_0 (*(uint32_t*)0x1FFFF7E8) 32 #define U_ID_1 (*(uint32_t*)0x1FFFF7EC) 33 #define U_ID_2 (*(uint32_t*)0x1FFFF7F0) 35 #define NAZE_SPI_INSTANCE SPI2 36 #define NAZE_SPI_CS_GPIO GPIOB 37 #define NAZE_SPI_CS_PIN GPIO_Pin_12 38 #define NAZE_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB 41 #define M25P16_CS_GPIO NAZE_SPI_CS_GPIO 42 #define M25P16_CS_PIN NAZE_SPI_CS_PIN 43 #define M25P16_SPI_INSTANCE NAZE_SPI_INSTANCE 51 #define M25P16_INSTRUCTION_RDID 0x9F 52 #define M25P16_INSTRUCTION_READ_BYTES 0x03 53 #define M25P16_INSTRUCTION_READ_STATUS_REG 0x05 54 #define M25P16_INSTRUCTION_WRITE_STATUS_REG 0x01 55 #define M25P16_INSTRUCTION_WRITE_ENABLE 0x06 56 #define M25P16_INSTRUCTION_WRITE_DISABLE 0x04 57 #define M25P16_INSTRUCTION_PAGE_PROGRAM 0x02 58 #define M25P16_INSTRUCTION_SECTOR_ERASE 0xD8 59 #define M25P16_INSTRUCTION_BULK_ERASE 0xC7 61 #define M25P16_STATUS_FLAG_WRITE_IN_PROGRESS 0x01 62 #define M25P16_STATUS_FLAG_WRITE_ENABLED 0x02 65 #define JEDEC_ID_MICRON_M25P16 0x202015 66 #define JEDEC_ID_MICRON_N25Q064 0x20BA17 67 #define JEDEC_ID_WINBOND_W25Q64 0xEF4017 68 #define JEDEC_ID_MICRON_N25Q128 0x20ba18 69 #define JEDEC_ID_WINBOND_W25Q128 0xEF4018 71 #define DISABLE_M25P16 GPIO_SetBits(M25P16_CS_GPIO, M25P16_CS_PIN) 72 #define ENABLE_M25P16 GPIO_ResetBits(M25P16_CS_GPIO, M25P16_CS_PIN) 75 #define DEFAULT_TIMEOUT_MILLIS 6 78 #define SECTOR_ERASE_TIMEOUT_MILLIS 5000 79 #define BULK_ERASE_TIMEOUT_MILLIS 21000 140 if (
millis() - time > timeoutMillis) {
174 chipID = (in[1] << 16) | (in[2] << 8) | (in[3]);
#define M25P16_INSTRUCTION_SECTOR_ERASE
#define JEDEC_ID_MICRON_N25Q064
#define M25P16_SPI_INSTANCE
#define JEDEC_ID_WINBOND_W25Q128
volatile uint32_t millis(void)
bool m25p16_waitForReady(uint32_t timeoutMillis)
void spiSetDivisor(SPI_TypeDef *instance, uint16_t divisor)
#define SECTOR_ERASE_TIMEOUT_MILLIS
static uint8_t buffer[BMP280_DATA_FRAME_SIZE]
int m25p16_readBytes(uint32_t address, uint8_t *buffer, int length)
uint8_t spiTransferByte(SPI_TypeDef *instance, uint8_t data)
This file contains all the functions prototypes for the GPIO firmware library.
void m25p16_pageProgram(uint32_t address, const uint8_t *data, int length)
const flashGeometry_t * m25p16_getGeometry()
#define M25P16_INSTRUCTION_WRITE_ENABLE
void m25p16_pageProgramContinue(const uint8_t *data, int length)
#define SPI_18MHZ_CLOCK_DIVIDER
void m25p16_eraseCompletely()
static flashGeometry_t geometry
ROSLIB_DECL std::string command(const std::string &cmd)
#define BULK_ERASE_TIMEOUT_MILLIS
#define JEDEC_ID_MICRON_N25Q128
#define M25P16_INSTRUCTION_READ_STATUS_REG
#define JEDEC_ID_WINBOND_W25Q64
void spiTransfer(SPI_TypeDef *instance, uint8_t *out, const uint8_t *in, int len)
#define M25P16_STATUS_FLAG_WRITE_IN_PROGRESS
#define JEDEC_ID_MICRON_M25P16
static void m25p16_writeEnable()
void m25p16_pageProgramBegin(uint32_t address)
#define M25P16_INSTRUCTION_READ_BYTES
#define DEFAULT_TIMEOUT_MILLIS
#define M25P16_INSTRUCTION_PAGE_PROGRAM
static void m25p16_performOneByteCommand(uint8_t command)
#define M25P16_INSTRUCTION_BULK_ERASE
void m25p16_pageProgramFinish()
#define M25P16_INSTRUCTION_RDID
void m25p16_eraseSector(uint32_t address)
static bool m25p16_readIdentification()
static uint8_t m25p16_readStatus()