add prefix capability to swo_log

This commit is contained in:
Kilian Bracher 2025-04-11 14:03:13 +02:00
parent 9b32e69b6d
commit babea2e805
Signed by: k.bracher
SSH Key Fingerprint: SHA256:mXpyZkK7RDiJ7qeHCKJX108woM0cl5TrCvNBJASu6lM
5 changed files with 923 additions and 911 deletions

View File

@ -19,13 +19,15 @@
#define PRINT_TIMESTAMP false // if true, timestamp (from HAL_GetTick) is printed before each log message
#if !USE_MULTIPLE_CHANNELS
#define DEBUG_CHANNEL 0 // channel to output messages on
#define USE_CHANNEL_MASK_VARIABLE true
#ifndef DEBUG_CHANNEL
#define DEBUG_CHANNEL 0 // channel to output messages on
#endif
#define USE_CHANNEL_MASK_VARIABLE true
#endif
#if USE_CHANNEL_MASK_VARIABLE
#define MASK_VARIABLE logging_mask // variable to store the channel mask, must be globally defined somewhere
extern volatile uint32_t MASK_VARIABLE;
#define MASK_VARIABLE logging_mask // variable to store the channel mask, must be globally defined somewhere
extern volatile uint32_t MASK_VARIABLE;
#endif
enum log_level_t {
@ -129,6 +131,10 @@ static inline void debug_log(enum log_level_t level, const char *msg, ...) {
}
__swo_print(level, __time_buffer);
}
#ifdef SWO_LOG_PREFIX
__swo_print(level, SWO_LOG_PREFIX);
#endif
__swo_print(level, log_level_names[level]);
__swo_print(level, __swo_buffer);

View File

@ -4,15 +4,16 @@
* Created on: 14.07.2022
* Author: max
*/
#include "ADBMS_Abstraction.h"
#include "ADBMS_CMD_MAKROS.h"
#include "ADBMS_LL_Driver.h"
#include "config_ADBMS6830.h"
#include "swo_log.h"
#include <stddef.h>
#include "NTC.h"
#define SWO_LOG_PREFIX "[ADBMS] "
#include "swo_log.h"
static const char* const HAL_Statuses[] = {"HAL_OK", "HAL_ERROR", "HAL_BUSY", "HAL_TIMEOUT"};
#define CHECK_RETURN(x) \

View File

@ -10,10 +10,12 @@
#include "ADBMS_Driver.h"
#include "config_ADBMS6830.h"
#include "stm32h7xx_hal.h"
#include "swo_log.h"
#include <stdint.h>
#include <string.h>
#define SWO_LOG_PREFIX "[ADBMS] "
#include "swo_log.h"
Cell_Module modules[N_BMS] = {};
uint32_t balancedCells = 0;
bool balancingActive = false;

View File

@ -8,10 +8,12 @@
#include "ADBMS_LL_Driver.h"
#include "config_ADBMS6830.h"
#include "stm32h7xx_hal.h"
#include "swo_log.h"
#include <stdint.h>
#include <strings.h>
#define SWO_LOG_PREFIX "[ADBMS] "
#include "swo_log.h"
#define INITIAL_COMMAND_PEC 0x0010
#define INITIAL_DATA_PEC 0x0010

File diff suppressed because it is too large Load Diff