Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement eeprom_write_qword as define #23890

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions platforms/eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ void eeprom_update_dword(uint32_t *__p, uint32_t __value);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
#endif

static inline void eeprom_write_qword(uint64_t *__p, uint64_t __value) {
eeprom_update_block(&__value, __p, sizeof(uint64_t));
}
// While newer avr-libc versions may have an implementation
// use preprocessor as to not cause conflicts
#undef eeprom_write_qword
#define eeprom_write_qword(__p, __value) \
do { \
uint64_t tmp = __value; \
eeprom_update_block(&tmp, __p, sizeof(uint64_t)); \
} while (0)

#if defined(EEPROM_CUSTOM)
# ifndef EEPROM_SIZE
Expand Down
Loading