void m25p16_eraseCompletely() { m25p16_waitForReady(BULK_ERASE_TIMEOUT_MILLIS); m25p16_writeEnable(); m25p16_performOneByteCommand(M25P16_INSTRUCTION_BULK_ERASE); }
void m25p16_pageProgramBegin(uint32_t address) { uint8_t command[] = { M25P16_INSTRUCTION_PAGE_PROGRAM, (address >> 16) & 0xFF, (address >> 8) & 0xFF, address & 0xFF}; m25p16_waitForReady(DEFAULT_TIMEOUT_MILLIS); m25p16_writeEnable(); ENABLE_M25P16; spiTransfer(M25P16_SPI_INSTANCE, NULL, command, sizeof(command)); }
/** * Erase a sector full of bytes to all 1's at the given byte offset in the flash chip. */ void m25p16_eraseSector(uint32_t address) { uint8_t out[] = { M25P16_INSTRUCTION_SECTOR_ERASE, (address >> 16) & 0xFF, (address >> 8) & 0xFF, address & 0xFF}; m25p16_waitForReady(SECTOR_ERASE_TIMEOUT_MILLIS); m25p16_writeEnable(); ENABLE_M25P16; spiTransfer(M25P16_SPI_INSTANCE, NULL, out, sizeof(out)); DISABLE_M25P16; }