MCPcopy Create free account
hub / github.com/LowPowerLab/SPIFlash / readBytes

Method readBytes

SPIFlash.cpp:161–170  ·  view source on GitHub ↗

read unlimited # of bytes

Source from the content-addressed store, hash-verified

159
160/// read unlimited # of bytes
161void SPIFlash::readBytes(uint32_t addr, void* buf, uint16_t len) {
162 command(SPIFLASH_ARRAYREAD);
163 SPI.transfer(addr >> 16);
164 SPI.transfer(addr >> 8);
165 SPI.transfer(addr);
166 SPI.transfer(0); //"dont care"
167 for (uint16_t i = 0; i < len; ++i)
168 ((uint8_t*) buf)[i] = SPI.transfer(0);
169 unselect();
170}
171
172/// Send a command to the flash chip, pass TRUE for isWrite when its a write command
173void SPIFlash::command(uint8_t cmd, boolean isWrite){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected