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

Method capacity

SerialFlashChip.cpp:448–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448uint32_t SerialFlashChip::capacity(const uint8_t *id)
449{
450 uint32_t n = 1048576; // unknown chips, default to 1 MByte
451
452 if (id[2] >= 16 && id[2] <= 31) {
453 n = 1ul << id[2];
454 } else
455 if (id[2] >= 32 && id[2] <= 37) {
456 n = 1ul << (id[2] - 6);
457 } else
458 if ((id[0]==0 && id[1]==0 && id[2]==0) ||
459 (id[0]==255 && id[1]==255 && id[2]==255)) {
460 n = 0;
461 }
462 //Serial.printf("capacity %lu\n", n);
463 return n;
464}
465
466uint32_t SerialFlashChip::blockSize()
467{

Callers 1

createMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected