|
|
@@ -32,16 +32,6 @@ |
|
|
|
#define CSRELEASE() DIRECT_WRITE_HIGH(cspin_basereg, cspin_bitmask) |
|
|
|
#define SPICONFIG SPISettings(50000000, MSBFIRST, SPI_MODE0) |
|
|
|
|
|
|
|
#if defined(__arc__) |
|
|
|
// Use SPI1 on Arduino 101 (accesses chip already on the board) |
|
|
|
#define SPIPORT SPI1 |
|
|
|
#elif 0 |
|
|
|
// Add cases here, if you wish to use other SPI ports... |
|
|
|
#else |
|
|
|
// Otherwise, use the normal SPI port. |
|
|
|
#define SPIPORT SPI |
|
|
|
#endif |
|
|
|
|
|
|
|
uint16_t SerialFlashChip::dirindex = 0; |
|
|
|
uint8_t SerialFlashChip::flags = 0; |
|
|
|
uint8_t SerialFlashChip::busy = 0; |
|
|
@@ -49,6 +39,8 @@ uint8_t SerialFlashChip::busy = 0; |
|
|
|
static volatile IO_REG_TYPE *cspin_basereg; |
|
|
|
static IO_REG_TYPE cspin_bitmask; |
|
|
|
|
|
|
|
static SPIClass& SPIPORT = SPI; |
|
|
|
|
|
|
|
#define FLAG_32BIT_ADDR 0x01 // larger than 16 MByte address |
|
|
|
#define FLAG_STATUS_CMD70 0x02 // requires special busy flag check |
|
|
|
#define FLAG_DIFF_SUSPEND 0x04 // uses 2 different suspend commands |
|
|
@@ -341,6 +333,12 @@ bool SerialFlashChip::ready() |
|
|
|
//#define FLAG_DIFF_SUSPEND 0x04 // uses 2 different suspend commands |
|
|
|
//#define FLAG_256K_BLOCKS 0x10 // has 256K erase blocks |
|
|
|
|
|
|
|
bool SerialFlashChip::begin(SPIClass& device, uint8_t pin) |
|
|
|
{ |
|
|
|
SPIPORT = device; |
|
|
|
return begin(pin); |
|
|
|
} |
|
|
|
|
|
|
|
bool SerialFlashChip::begin(uint8_t pin) |
|
|
|
{ |
|
|
|
uint8_t id[5]; |