mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-08 09:19:10 +00:00
Fix i2c EEPROM compile issue when Console is enabled (#9186)
* Fix i2c EEPROM compile issue when Console is enabled * Only use if both console and debugging is enabled
This commit is contained in:
parent
2ac3a51d71
commit
883dd2df80
1 changed files with 7 additions and 6 deletions
|
@ -37,8 +37,9 @@
|
|||
|
||||
// #define DEBUG_EEPROM_OUTPUT
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
# include "print.h"
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
# include "timer.h"
|
||||
# include "debug.h"
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
static inline void init_i2c_if_required(void) {
|
||||
|
@ -60,7 +61,7 @@ static inline void fill_target_address(uint8_t *buffer, const void *addr) {
|
|||
void eeprom_driver_init(void) {}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
#ifdef CONSOLE_ENABLE
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
uint32_t start = timer_read32();
|
||||
#endif
|
||||
|
||||
|
@ -70,7 +71,7 @@ void eeprom_driver_erase(void) {
|
|||
eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
}
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start)));
|
||||
#endif
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
|||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE, 100);
|
||||
i2c_receive(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), buf, len, 100);
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM R] 0x%04X: ", ((int)addr));
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
|
||||
|
@ -110,7 +111,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
|||
complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + i] = read_buf[i];
|
||||
}
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM W] 0x%04X: ", ((int)target_addr));
|
||||
for (uint8_t i = 0; i < write_length; i++) {
|
||||
dprintf(" %02X", (int)(read_buf[i]));
|
||||
|
|
Loading…
Reference in a new issue