this is using the mbed os version 5-13-1
Embed:
(wiki syntax)
Show/hide line numbers
debug.h
Go to the documentation of this file.
00001 /** 00002 ******************************************************************************** 00003 * @file debug.h 00004 * @brief Header file containing API for debug.c 00005 * 00006 ******************************************************************************** 00007 * @author TTP 00008 * @copyright(c) 2017 TTP (The Technology Partnership) plc 00009 * 00010 ******************************************************************************** 00011 */ 00012 00013 #ifndef DEBUG_H 00014 #define DEBUG_H 00015 00016 //-------- Includes ----------------------------------------------------------// 00017 00018 #include <string.h> 00019 #include <stdio.h> 00020 #include <stdint.h> 00021 #include <stdlib.h> 00022 #include <stdarg.h> 00023 #include <math.h> 00024 00025 //-------- Defines -----------------------------------------------------------// 00026 00027 #define SVN_FW_VER_STRING_LEN_BYTES 12 00028 #define REL_FW_VER_STRING_LEN_BYTES 12 00029 #define FW_VER_STRING_LEN_BYTES SVN_FW_VER_STRING_LEN_BYTES + REL_FW_VER_STRING_LEN_BYTES 00030 00031 #define REL_FW_VER_STRING "1.0.0" //used by a fixed size array ! 00032 00033 #define DBG_RX_CMDDATA_SIZE_BYTES 32 00034 00035 #define dbg_printf(debug_level, ...) dbg_print(FILE_CODE, __LINE__, debug_level, __VA_ARGS__) 00036 //#define FULL_DEBUG_ENABLED 00037 //-------- Constants & enums -------------------------------------------------// 00038 00039 /** 00040 * @brief Enumeration of the different data modes allowed 00041 */ 00042 typedef enum 00043 { 00044 DATA_ASCII, 00045 DATA_FLASH, 00046 DATA_ASCII_BINARY, // Mode for doing flash verification 00047 DATA_SD_CARD // Data is for SD Card 00048 00049 } data_mode_e; 00050 00051 /** 00052 * @brief Enumeration of the different debug log levels allowed 00053 */ 00054 typedef enum 00055 { 00056 NONE = 0x00, 00057 LOG = 0x01, 00058 ERR = 0x02, 00059 DBG = 0x04, 00060 TXT = 0x08, 00061 00062 } debug_log_level_e; 00063 00064 00065 //-------- Structs & typedefs ------------------------------------------------// 00066 00067 //-------- Global variables --------------------------------------------------// 00068 00069 //--- Global function prototypes ----------------------------------------// 00070 00071 void initialise_debug(uint8_t debug_level); 00072 00073 void set_debug_level(uint8_t debug_level); 00074 00075 uint8_t get_debug_level(void); 00076 00077 //extern UART_HandleTypeDef* get_uart2_address(void); 00078 00079 const char* get_dbg_tx_terminate_string (void); 00080 00081 uint8_t get_dbg_tx_terminate_string_len (void); 00082 00083 const char* get_fw_ver_string(void); 00084 00085 const uint8_t* get_fw_ver_bytes(void); 00086 00087 void debug_setDataMode(data_mode_e mode); 00088 00089 void print_debug_hex(const uint8_t* p_buf, uint16_t len); 00090 00091 //void dbg_printf(uint8_t debug_level, const char *text, ...); 00092 void dbg_print(const char* file_name, uint16_t line_number, 00093 uint8_t debug_level, const char *text, ...); 00094 //----------------------------------------------------------------------------// 00095 00096 #endif /* DEBUG_H */ 00097
Generated on Wed Jul 13 2022 05:40:26 by
1.7.2