uint32 eeprom_deepsleep() { eeprom_disable(); ee_deepsleep = true; ee_enabled = false; ee_wren = false; return 0; }
static void eeprom_generic_write(unsigned char *addr, unsigned char val) { signed char i; unsigned short cmd; eeprom_enable(); cmd = 0x0a00 | (size_t) addr; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); for (i = 7; i >= 0; --i) eeprom_pulse(EEPROM_MASK(val, bitmask[i])); eeprom_disable(); eeprom_enable(); while (EEPROM_DO == 0); eeprom_disable(); }
void eeprom_erase_all(void) { signed char i; unsigned short cmd; eeprom_write_enable(); eeprom_enable(); cmd = 0x0900; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); eeprom_disable(); eeprom_enable(); while (EEPROM_DO == 0); eeprom_disable(); eeprom_write_disable(); }
void eeprom_erase(unsigned char *addr) { signed char i; unsigned short cmd; eeprom_write_enable(); eeprom_enable(); cmd = 0x0e00 | (size_t) addr; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); eeprom_disable(); eeprom_enable(); while (EEPROM_DO == 0); eeprom_disable(); eeprom_write_disable(); }
static void eeprom_write_disable(void) { signed char i; unsigned short cmd; eeprom_enable(); cmd = 0x0800; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); eeprom_disable(); }
void eeprom_fill_all(const unsigned char c) { signed char i; unsigned short cmd; eeprom_write_enable(); eeprom_enable(); cmd = 0x0880; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); for (i = 7; i >= 0; --i) eeprom_pulse(EEPROM_MASK(c, bitmask[i])); eeprom_disable(); eeprom_enable(); while (EEPROM_DO == 0); eeprom_disable(); eeprom_write_disable(); }
unsigned char eeprom_read_byte(const unsigned char *addr) { signed char i; unsigned char c; unsigned short cmd; eeprom_enable(); cmd = 0x0c00 | (size_t) addr; for (i = 11; i >= 0; --i) eeprom_pulse(EEPROM_MASK(cmd, bitmask[i])); c = 0; for (i = 7; i >= 0; --i) c += ((unsigned char) eeprom_pulse(EEPROM_LOW) << i); eeprom_disable(); return c; }