Skip to content

Commit

Permalink
Added eeprom debugging; cleaned up flash mocking
Browse files Browse the repository at this point in the history
The following options were added:
* debug_config.eeprom flag added (debug_eeprom)
* BOOTMAGIC 'E' key will toggle debug_eeprom
* Command key 'R' will toggle debug_eeprom
* Command key 'P' will print EEPROM contents (stm32 only)

Fix for stm32eeprom_parser.py checking via signature with wrong base
  • Loading branch information
dkjer committed Aug 20, 2021
1 parent a6e8233 commit af90e1f
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 171 deletions.
31 changes: 31 additions & 0 deletions quantum/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
#include "version.h"

#ifdef STM32_EEPROM_ENABLE
# include "eeprom_stm32.h"
#endif

#ifdef BACKLIGHT_ENABLE
# include "backlight.h"
#endif
Expand Down Expand Up @@ -113,6 +117,10 @@ static void command_common_help(void) {
STR(MAGIC_KEY_DEBUG_KBD) ": Keyboard Debug Toggle"
" - Show keypress report\n"
STR(MAGIC_KEY_DEBUG_MOUSE) ": Debug Mouse Toggle\n"
STR(MAGIC_KEY_DEBUG_EEPROM) ": Debug EEPROM Toggle\n"
#ifdef STM32_EEPROM_ENABLE
STR(MAGIC_KEY_PRINT_EEPROM) ": Print EEPROM Contents\n"
#endif
STR(MAGIC_KEY_VERSION) ": Version\n"
STR(MAGIC_KEY_STATUS) ": Status\n"
STR(MAGIC_KEY_CONSOLE) ": Activate Console Mode\n"
Expand Down Expand Up @@ -259,12 +267,14 @@ static void print_eeconfig(void) {
".matrix: %u\n"
".keyboard: %u\n"
".mouse: %u\n"
".eeprom: %u\n"

, dc.raw
, dc.enable
, dc.matrix
, dc.keyboard
, dc.mouse
, dc.eeprom
); /* clang-format on */

keymap_config_t kc;
Expand Down Expand Up @@ -373,6 +383,7 @@ static bool command_common(uint8_t code) {
debug_matrix = false;
debug_keyboard = false;
debug_mouse = false;
debug_eeprom = false;
debug_enable = false;
command_console_help();
print("C> ");
Expand All @@ -396,6 +407,7 @@ static bool command_common(uint8_t code) {
debug_matrix = false;
debug_keyboard = false;
debug_mouse = false;
debug_eeprom = false;
}
break;

Expand Down Expand Up @@ -432,6 +444,25 @@ static bool command_common(uint8_t code) {
}
break;

// debug eeprom toggle
case MAGIC_KC(MAGIC_KEY_DEBUG_EEPROM):
debug_eeprom = !debug_eeprom;
if (debug_eeprom) {
print("\neeprom: on\n");
debug_enable = true;
} else {
print("\neeprom: off\n");
}
break;

#ifdef STM32_EEPROM_ENABLE
// print eeprom contents
case MAGIC_KC(MAGIC_KEY_PRINT_EEPROM):
print("EEPROM Contents:\n");
print_eeprom();
break;
#endif

// print version
case MAGIC_KC(MAGIC_KEY_VERSION):
print_version();
Expand Down
10 changes: 10 additions & 0 deletions quantum/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ bool command_proc(uint8_t code);
# define MAGIC_KEY_DEBUG_MOUSE M
#endif

#ifdef STM32_EEPROM_ENABLE
# ifndef MAGIC_KEY_PRINT_EEPROM
# define MAGIC_KEY_PRINT_EEPROM P
# endif
#endif

#ifndef MAGIC_KEY_DEBUG_EEPROM
# define MAGIC_KEY_DEBUG_EEPROM R
#endif

#ifndef MAGIC_KEY_VERSION
# define MAGIC_KEY_VERSION V
#endif
Expand Down
1 change: 1 addition & 0 deletions quantum/eeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EECONFIG_DEBUG_MATRIX (1 << 1)
#define EECONFIG_DEBUG_KEYBOARD (1 << 2)
#define EECONFIG_DEBUG_MOUSE (1 << 3)
#define EECONFIG_DEBUG_EEPROM (1 << 4)

/* keyconf bit */
#define EECONFIG_KEYMAP_SWAP_CONTROL_CAPSLOCK (1 << 0)
Expand Down
1 change: 1 addition & 0 deletions quantum/logging/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ debug_config_t debug_config = {
.matrix = false, //
.keyboard = false, //
.mouse = false, //
.eeprom = false, //
.reserved = 0 //
};
4 changes: 3 additions & 1 deletion quantum/logging/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ typedef union {
bool matrix : 1;
bool keyboard : 1;
bool mouse : 1;
uint8_t reserved : 4;
bool eeprom : 1;
uint8_t reserved : 3;
};
uint8_t raw;
} debug_config_t;
Expand All @@ -49,6 +50,7 @@ extern debug_config_t debug_config;
#define debug_matrix (debug_config.matrix)
#define debug_keyboard (debug_config.keyboard)
#define debug_mouse (debug_config.mouse)
#define debug_eeprom (debug_config.eeprom)

/*
* Debug print utils
Expand Down
Loading

0 comments on commit af90e1f

Please sign in to comment.