| 265 | } |
| 266 | |
| 267 | void 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 | |
| 291 | bool SerialFlashChip::ready() |