arduino-sram
arduino-sram copied to clipboard
i cant find mothod 'readBytes' ,it make me confused ???
char test [] = "hello, world abcdefghijklmnopqrstuvwxyz"; sram.seek(1); sram.write((byte *) test, sizeof test); // sram.write('x'); char buf[20]; sram.seek(1); sram.readBytes((char *) buf, 20); Serial.println(buf);
by the way ,i cant find mothod 'readBytes' ,it make me confused ???
thanks very much!!!
i write a new BYTE_MODE ,it work ok
size_t SRAM::write1Byte(long addr,uint8_t data) {
digitalWrite(this->cs_pin, LOW);
SPI.transfer(SRAM_WRITE);
if(this->size == SRAM_1024)
SPI.transfer((addr >> 16) & 0xFF);
SPI.transfer((addr >> 8) & 0xFF); SPI.transfer(addr & 0xFF); SPI.transfer(data); digitalWrite(cs_pin, HIGH);
return 1; } char SRAM::read1Byte(long addr) { digitalWrite(this->cs_pin, LOW); SPI.transfer(SRAM_READ); if(this->size == SRAM_1024) SPI.transfer((addr >> 16) & 0xFF);
SPI.transfer((addr >> 8) & 0xFF); SPI.transfer(addr & 0xFF); char data = SPI.transfer(0); digitalWrite(this->cs_pin, HIGH);
return data; }
哈哈 谢谢你的程序给我带来思路