fx2eeprom.h
The fx2eeprom.h header contains EEPROM routines for the Cypress FX2 series. When using this header, the fx2 library must be linked in.
Reference
Functions
-
bool eeprom_read(uint8_t chip, uint16_t addr, uint8_t *buf, uint16_t len, bool double_byte)
This function reads
lenbytes at memory addressaddrfrom EEPROM chip with bus addresschiptobuf. It writes two address bytes ifdouble_byteis true.Returns
trueif the read is successful,falseotherwise.
-
bool eeprom_write(uint8_t chip, uint16_t addr, uint8_t *buf, uint16_t len, bool double_byte, uint8_t page_size, uint8_t timeout)
This function writes
lenbytes at memory addressaddrto EEPROM chip with bus addresschipfrombuf. It writes two address bytes ifdouble_byteis true.Data is written in chunks up to
2 ** page_sizebytes, with each chunk ending on an address that is a multiple of2 ** page_size. Use the page size specified in the EEPROM datasheet for significantly higher write performance.timeoutspecifies the number of polling attempts after a write; 0 means wait forever. At 100 kHz, one polling attempt is ~120 us, at 400 kHz, ~30 us, so for typical wait cycles of up to 5 ms, a timeout of 166 should be sufficient in all cases.Returns
trueif the write is successful,falseotherwise.