Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
source/debug.h@103:7b566b522427, 2019-05-02 (annotated)
- Committer:
- ocomeni
- Date:
- Thu May 02 21:50:17 2019 +0000
- Revision:
- 103:7b566b522427
- Child:
- 104:11e9605093c9
reached cloud hello message in box comms sequence
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ocomeni | 103:7b566b522427 | 1 | /** |
ocomeni | 103:7b566b522427 | 2 | ******************************************************************************** |
ocomeni | 103:7b566b522427 | 3 | * @file debug.h |
ocomeni | 103:7b566b522427 | 4 | * @brief Header file containing API for debug.c |
ocomeni | 103:7b566b522427 | 5 | * |
ocomeni | 103:7b566b522427 | 6 | ******************************************************************************** |
ocomeni | 103:7b566b522427 | 7 | * @author TTP |
ocomeni | 103:7b566b522427 | 8 | * @copyright(c) 2017 TTP (The Technology Partnership) plc |
ocomeni | 103:7b566b522427 | 9 | * |
ocomeni | 103:7b566b522427 | 10 | ******************************************************************************** |
ocomeni | 103:7b566b522427 | 11 | */ |
ocomeni | 103:7b566b522427 | 12 | |
ocomeni | 103:7b566b522427 | 13 | #ifndef DEBUG_H |
ocomeni | 103:7b566b522427 | 14 | #define DEBUG_H |
ocomeni | 103:7b566b522427 | 15 | |
ocomeni | 103:7b566b522427 | 16 | //-------- Includes ----------------------------------------------------------// |
ocomeni | 103:7b566b522427 | 17 | |
ocomeni | 103:7b566b522427 | 18 | #include <string.h> |
ocomeni | 103:7b566b522427 | 19 | #include <stdio.h> |
ocomeni | 103:7b566b522427 | 20 | #include <stdint.h> |
ocomeni | 103:7b566b522427 | 21 | #include <stdlib.h> |
ocomeni | 103:7b566b522427 | 22 | #include <stdarg.h> |
ocomeni | 103:7b566b522427 | 23 | #include <math.h> |
ocomeni | 103:7b566b522427 | 24 | |
ocomeni | 103:7b566b522427 | 25 | //-------- Defines -----------------------------------------------------------// |
ocomeni | 103:7b566b522427 | 26 | |
ocomeni | 103:7b566b522427 | 27 | #define SVN_FW_VER_STRING_LEN_BYTES 12 |
ocomeni | 103:7b566b522427 | 28 | #define REL_FW_VER_STRING_LEN_BYTES 12 |
ocomeni | 103:7b566b522427 | 29 | #define FW_VER_STRING_LEN_BYTES SVN_FW_VER_STRING_LEN_BYTES + REL_FW_VER_STRING_LEN_BYTES |
ocomeni | 103:7b566b522427 | 30 | |
ocomeni | 103:7b566b522427 | 31 | #define REL_FW_VER_STRING "1.0.0" //used by a fixed size array ! |
ocomeni | 103:7b566b522427 | 32 | |
ocomeni | 103:7b566b522427 | 33 | #define DBG_RX_CMDDATA_SIZE_BYTES 32 |
ocomeni | 103:7b566b522427 | 34 | |
ocomeni | 103:7b566b522427 | 35 | //#define dbg_printf(debug_level, ...) dbg_print(FILE_CODE, __LINE__, debug_level, __VA_ARGS__) |
ocomeni | 103:7b566b522427 | 36 | |
ocomeni | 103:7b566b522427 | 37 | //-------- Constants & enums -------------------------------------------------// |
ocomeni | 103:7b566b522427 | 38 | |
ocomeni | 103:7b566b522427 | 39 | /** |
ocomeni | 103:7b566b522427 | 40 | * @brief Enumeration of the different data modes allowed |
ocomeni | 103:7b566b522427 | 41 | */ |
ocomeni | 103:7b566b522427 | 42 | typedef enum |
ocomeni | 103:7b566b522427 | 43 | { |
ocomeni | 103:7b566b522427 | 44 | DATA_ASCII, |
ocomeni | 103:7b566b522427 | 45 | DATA_FLASH, |
ocomeni | 103:7b566b522427 | 46 | DATA_ASCII_BINARY, // Mode for doing flash verification |
ocomeni | 103:7b566b522427 | 47 | DATA_SD_CARD // Data is for SD Card |
ocomeni | 103:7b566b522427 | 48 | |
ocomeni | 103:7b566b522427 | 49 | } data_mode_e; |
ocomeni | 103:7b566b522427 | 50 | |
ocomeni | 103:7b566b522427 | 51 | /** |
ocomeni | 103:7b566b522427 | 52 | * @brief Enumeration of the different debug log levels allowed |
ocomeni | 103:7b566b522427 | 53 | */ |
ocomeni | 103:7b566b522427 | 54 | typedef enum |
ocomeni | 103:7b566b522427 | 55 | { |
ocomeni | 103:7b566b522427 | 56 | NONE = 0x00, |
ocomeni | 103:7b566b522427 | 57 | LOG = 0x01, |
ocomeni | 103:7b566b522427 | 58 | ERR = 0x02, |
ocomeni | 103:7b566b522427 | 59 | DBG = 0x04, |
ocomeni | 103:7b566b522427 | 60 | TXT = 0x08, |
ocomeni | 103:7b566b522427 | 61 | |
ocomeni | 103:7b566b522427 | 62 | } debug_log_level_e; |
ocomeni | 103:7b566b522427 | 63 | |
ocomeni | 103:7b566b522427 | 64 | |
ocomeni | 103:7b566b522427 | 65 | //-------- Structs & typedefs ------------------------------------------------// |
ocomeni | 103:7b566b522427 | 66 | |
ocomeni | 103:7b566b522427 | 67 | //-------- Global variables --------------------------------------------------// |
ocomeni | 103:7b566b522427 | 68 | |
ocomeni | 103:7b566b522427 | 69 | //--- Global function prototypes ----------------------------------------// |
ocomeni | 103:7b566b522427 | 70 | |
ocomeni | 103:7b566b522427 | 71 | void initialise_debug(void); |
ocomeni | 103:7b566b522427 | 72 | |
ocomeni | 103:7b566b522427 | 73 | void set_debug_level(uint8_t debug_level); |
ocomeni | 103:7b566b522427 | 74 | |
ocomeni | 103:7b566b522427 | 75 | uint8_t get_debug_level(void); |
ocomeni | 103:7b566b522427 | 76 | |
ocomeni | 103:7b566b522427 | 77 | //extern UART_HandleTypeDef* get_uart2_address(void); |
ocomeni | 103:7b566b522427 | 78 | |
ocomeni | 103:7b566b522427 | 79 | const char* get_dbg_tx_terminate_string(void); |
ocomeni | 103:7b566b522427 | 80 | |
ocomeni | 103:7b566b522427 | 81 | uint8_t get_dbg_tx_terminate_string_len(void); |
ocomeni | 103:7b566b522427 | 82 | |
ocomeni | 103:7b566b522427 | 83 | const char* get_fw_ver_string(void); |
ocomeni | 103:7b566b522427 | 84 | |
ocomeni | 103:7b566b522427 | 85 | const uint8_t* get_fw_ver_bytes(void); |
ocomeni | 103:7b566b522427 | 86 | |
ocomeni | 103:7b566b522427 | 87 | void debug_setDataMode(data_mode_e mode); |
ocomeni | 103:7b566b522427 | 88 | |
ocomeni | 103:7b566b522427 | 89 | void print_debug_hex(const uint8_t* p_buf, uint16_t len); |
ocomeni | 103:7b566b522427 | 90 | |
ocomeni | 103:7b566b522427 | 91 | void dbg_printf(uint8_t debug_level, const char *text, ...); |
ocomeni | 103:7b566b522427 | 92 | //void dbg_printf(uint8_t debug_level, ...); |
ocomeni | 103:7b566b522427 | 93 | //----------------------------------------------------------------------------// |
ocomeni | 103:7b566b522427 | 94 | |
ocomeni | 103:7b566b522427 | 95 | #endif /* DEBUG_H */ |
ocomeni | 103:7b566b522427 | 96 |