X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=firmware%2Feeprom.c;fp=firmware%2Feeprom.c;h=0000000000000000000000000000000000000000;hb=9c37d18b9c70fdb70dfec453398c4649e9e57586;hp=9027ed02fbf2809f35136b5bbd5dfc278dd8371e;hpb=49b6b6ad84ec47b4f9eb9ef131975cc5b72372a2;p=model-railway-devices.git diff --git a/firmware/eeprom.c b/firmware/eeprom.c deleted file mode 100644 index 9027ed0..0000000 --- a/firmware/eeprom.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include "eeprom.h" - -#define BIT(n) (1<<(n)) - -static void eeprom_wait(void) -{ - while(EECR&BIT(EEPE)) ; -} - -void eeprom_write(uint16_t addr, uint8_t data) -{ - eeprom_wait(); - EEARH = addr>>8; - EEARL = addr; - EEDR = data; - EECR = BIT(EEMPE); - EECR |= BIT(EEPE); - eeprom_wait(); -} - -uint8_t eeprom_read(uint16_t addr) -{ - eeprom_wait(); - EEARH = addr>>8; - EEARL = addr; - EECR = BIT(EERE); - return EEDR; -}