refactor: sync from template - ENABLE/DISABLE macro pattern

- board_config.h: replace #define/#undef with ENABLE/DISABLE constants
- All debug switches use ENABLE/DISABLE instead of define/undef
- Replace #ifdef with #if MACRO == ENABLE across all sources
- Sync updated README documentation
This commit is contained in:
Nova
2026-07-28 00:45:49 +08:00
parent 0cf931c0e9
commit 69352e92cf
7 changed files with 171 additions and 55 deletions
+14 -11
View File
@@ -1,6 +1,14 @@
#ifndef BOARD_CONFIG_H
#define BOARD_CONFIG_H
#ifndef DISABLE
#define DISABLE 0
#endif
#ifndef ENABLE
#define ENABLE 1
#endif
#define GD32E23XF4 0x10
#define GD32E23XF6 0x20
#define GD32E23XF8 0x40
@@ -11,30 +19,25 @@
/* >>>>>>>>>>>>>>>>>>>>[IIC TYPE DEFINE]<<<<<<<<<<<<<<<<<<<< */
// #define SOFTWARE_IIC // IIC Type : Software IIC
#undef SOFTWARE_IIC // IIC Type : Hardware IIC
#define SOFTWARE_IIC DISABLE // DISABLE: Hardware IIC; ENABLE: Software IIC
/* >>>>>>>>>>>>>>>>>>>>[DEBUG MODE]<<<<<<<<<<<<<<<<<<<< */
// #define DEBUG_MODE // Operating Mode : Debug Mode
#undef DEBUG_MODE // Operating Mode : Release Mode
#define DEBUG_MODE DISABLE // DISABLE: Release Mode; ENABLE: Debug Mode
/* >>>>>>>>>>>>>>>>>>>>[COMMAND DEBUG]<<<<<<<<<<<<<<<<<<<< */
// #define COM_DEBUG // Enable Command Debug Information
#undef COM_DEBUG // Disable Command Debug Information
#define COM_DEBUG DISABLE // DISABLE: Command debug off; ENABLE: Command debug on
/* >>>>>>>>>>>>>>>>>>>>[DEBUG ASSERTIONS DEFINE]<<<<<<<<<<<<<<<<<<<< */
// #define DEBUG_VERBOSE // Debug Assertions Status : Debug Verbose Information
#undef DEBUG_VERBOSE // Debug Assertions Status : No Debug Verbose Information
#define DEBUG_VERBOSE DISABLE // DISABLE: Verbose debug off; ENABLE: Verbose debug on
/* >>>>>>>>>>>>>>>>>>>>[SEGGER RTT DETECTION]<<<<<<<<<<<<<<<<<<<< */
#define SEGGER_RTT_DETECTION // SEGGER RTT Detection : Enable
// #undef SEGGER_RTT_DETECTION // SEGGER RTT Detection : Disable
#define SEGGER_RTT_DETECTION ENABLE // DISABLE: SEGGER RTT off; ENABLE: SEGGER RTT on
#ifdef SEGGER_RTT_DETECTION
#if SEGGER_RTT_DETECTION == ENABLE
#include "SEGGER_RTT.h"
#define RTT_printf(ch, ...) SEGGER_RTT_printf(ch, __VA_ARGS__)
#define RTT_WriteString(ch, s) SEGGER_RTT_WriteString(ch, s)
+3 -1
View File
@@ -86,7 +86,9 @@ i2c_result_t i2c_bus_reset(void);
\param[out] none
\retval none
*/
#if DEBUG_VERBOSE == ENABLE
void i2c_scan(void);
#endif
/*!
\brief write 16-bit data to I2C device
@@ -139,7 +141,7 @@ i2c_result_t i2c_read(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data, uint8
*/
i2c_result_t i2c_read_raw(uint8_t slave_addr, uint8_t *data, uint8_t length);
#ifdef DEBUG_VERBOSE
#if DEBUG_VERBOSE == ENABLE
/*!
\brief get status string for debugging
\param[in] status: i2c_result_t value