aboutsummaryrefslogtreecommitdiff
path: root/drivers/eeprom/eeprom_spi.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-05-24 15:02:00 -0700
committerGitHub <noreply@github.com>2020-05-24 23:02:00 +0100
commit2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8 (patch)
tree69472e54f5e9302fb233f4086a20724349f6a1d6 /drivers/eeprom/eeprom_spi.c
parentf66680d233d1abf61a38d3704a99941c62bfebbc (diff)
downloadqmk_firmware-2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8.tar.gz
qmk_firmware-2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8.zip
Fix SPI EEPROM compile issue when Console is enabled (#9193)
Diffstat (limited to 'drivers/eeprom/eeprom_spi.c')
-rw-r--r--drivers/eeprom/eeprom_spi.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/eeprom/eeprom_spi.c b/drivers/eeprom/eeprom_spi.c
index e10aaf14c..7b6416eaf 100644
--- a/drivers/eeprom/eeprom_spi.c
+++ b/drivers/eeprom/eeprom_spi.c
@@ -50,8 +50,9 @@
50# define EXTERNAL_EEPROM_SPI_TIMEOUT 100 50# define EXTERNAL_EEPROM_SPI_TIMEOUT 100
51#endif 51#endif
52 52
53#ifdef CONSOLE_ENABLE 53#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
54# include "print.h" 54# include "timer.h"
55# include "debug.h"
55#endif // CONSOLE_ENABLE 56#endif // CONSOLE_ENABLE
56 57
57static void init_spi_if_required(void) { 58static void init_spi_if_required(void) {
@@ -93,7 +94,7 @@ static void spi_eeprom_transmit_address(uintptr_t addr) {
93void eeprom_driver_init(void) {} 94void eeprom_driver_init(void) {}
94 95
95void eeprom_driver_erase(void) { 96void eeprom_driver_erase(void) {
96#ifdef CONSOLE_ENABLE 97#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
97 uint32_t start = timer_read32(); 98 uint32_t start = timer_read32();
98#endif 99#endif
99 100
@@ -103,7 +104,7 @@ void eeprom_driver_erase(void) {
103 eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE); 104 eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE);
104 } 105 }
105 106
106#ifdef CONSOLE_ENABLE 107#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
107 dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start))); 108 dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start)));
108#endif 109#endif
109} 110}
@@ -141,7 +142,7 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
141 spi_eeprom_transmit_address((uintptr_t)addr); 142 spi_eeprom_transmit_address((uintptr_t)addr);
142 spi_receive(buf, len); 143 spi_receive(buf, len);
143 144
144#ifdef DEBUG_EEPROM_OUTPUT 145#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
145 dprintf("[EEPROM R] 0x%08lX: ", ((uint32_t)(uintptr_t)addr)); 146 dprintf("[EEPROM R] 0x%08lX: ", ((uint32_t)(uintptr_t)addr));
146 for (size_t i = 0; i < len; ++i) { 147 for (size_t i = 0; i < len; ++i) {
147 dprintf(" %02X", (int)(((uint8_t *)buf)[i])); 148 dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
@@ -200,7 +201,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
200 return; 201 return;
201 } 202 }
202 203
203#ifdef DEBUG_EEPROM_OUTPUT 204#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
204 dprintf("[EEPROM W] 0x%08lX: ", ((uint32_t)(uintptr_t)target_addr)); 205 dprintf("[EEPROM W] 0x%08lX: ", ((uint32_t)(uintptr_t)target_addr));
205 for (size_t i = 0; i < write_length; i++) { 206 for (size_t i = 0; i < write_length; i++) {
206 dprintf(" %02X", (int)(uint8_t)(read_buf[i])); 207 dprintf(" %02X", (int)(uint8_t)(read_buf[i]));