MCPcopy Create free account
hub / github.com/PaulStoffregen/SerialFlash / eraseBlock

Method eraseBlock

SerialFlashChip.cpp:267–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void SerialFlashChip::eraseBlock(uint32_t addr)
268{
269 uint8_t f = flags;
270 if (busy) wait();
271 SPIPORT.beginTransaction(SPICONFIG);
272 CSASSERT();
273 SPIPORT.transfer(0x06); // write enable command
274 CSRELEASE();
275 delayMicroseconds(1);
276 CSASSERT();
277 if (f & FLAG_32BIT_ADDR) {
278 SPIPORT.transfer(0xD8);
279 SPIPORT.transfer16(addr >> 16);
280 SPIPORT.transfer16(addr);
281 } else {
282 SPIPORT.transfer16(0xD800 | ((addr >> 16) & 255));
283 SPIPORT.transfer16(addr);
284 }
285 CSRELEASE();
286 SPIPORT.endTransaction();
287 busy = 2;
288}
289
290
291bool SerialFlashChip::ready()

Callers 1

eraseMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected