#include "sram.h" // 23LCV512 64kB SPI SRAM uint8_t sram_status() { uint8_t v; PORTB &= ~(1 << 2); spi_transfer(0x05); v = spi_transfer(0x00); PORTB |= (1 << 2); return v; } uint8_t sram_read(uint16_t addr) { uint8_t v; PORTB &= ~(1 << 2); spi_transfer(0x03); spi_transfer(addr & 0xFF); spi_transfer(addr > 8); v = spi_transfer(0x00); PORTB |= (1 << 2); return v; } void sram_write(uint16_t addr, uint8_t v) { PORTB &= ~(1 << 2); spi_transfer(0x02); spi_transfer(addr & 0xFF); spi_transfer(addr > 8); spi_transfer(v); PORTB |= (1 << 2); }