Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
utility/logging.h@24:fb407a7f57bb, 2017-01-14 (annotated)
- Committer:
- cassyarduino
- Date:
- Sat Jan 14 21:25:56 2017 +0100
- Revision:
- 24:fb407a7f57bb
- Parent:
- 23:888d27c409df
- Child:
- 25:ef941d560208
Changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cassyarduino | 0:e3fb1267e3c3 | 1 | #ifndef __LOGGING_H__ |
cassyarduino | 0:e3fb1267e3c3 | 2 | #define __LOGGING_H__ |
cassyarduino | 0:e3fb1267e3c3 | 3 | |
cassyarduino | 0:e3fb1267e3c3 | 4 | #define LOG_NONE -1 /* Logging nothing */ |
cassyarduino | 0:e3fb1267e3c3 | 5 | #define LOG_EMERG 0 /* system is unusable */ |
cassyarduino | 0:e3fb1267e3c3 | 6 | #define LOG_ALERT 1 /* action must be taken immediately */ |
cassyarduino | 0:e3fb1267e3c3 | 7 | #define LOG_CRIT 2 /* critical conditions */ |
cassyarduino | 0:e3fb1267e3c3 | 8 | #define LOG_ERR 3 /* error conditions */ |
cassyarduino | 0:e3fb1267e3c3 | 9 | #define LOG_WARNING 4 /* warning conditions */ |
cassyarduino | 0:e3fb1267e3c3 | 10 | #define LOG_NOTICE 5 /* normal but significant condition */ |
cassyarduino | 0:e3fb1267e3c3 | 11 | #define LOG_INFO 6 /* informational */ |
cassyarduino | 0:e3fb1267e3c3 | 12 | #define LOG_DEBUG 7 /* debug-level messages */ |
cassyarduino | 0:e3fb1267e3c3 | 13 | #define LOG_DEBUG_V1 8 /* debug-verbose-level (v) messages */ |
cassyarduino | 0:e3fb1267e3c3 | 14 | #define LOG_DEBUG_V2 9 /* debug-verbose-level (vv) messages */ |
cassyarduino | 0:e3fb1267e3c3 | 15 | #define LOG_DEBUG_V3 10 /* debug-verbose-level (vvv) messages */ |
cassyarduino | 0:e3fb1267e3c3 | 16 | |
cassyarduino | 2:2f693560ad53 | 17 | #warning "You can configure LogObject and ACTLOGLEVEL in 'utility/logging.h'. More verbosity more memory usage." |
cassyarduino | 20:fe5026169ec6 | 18 | #define ACTLOGLEVEL LOG_NONE |
cassyarduino | 15:97bc2d681e36 | 19 | //#define ACTLOGLEVEL LOG_WARNING |
cassyarduino | 20:fe5026169ec6 | 20 | //#define ACTLOGLEVEL LOG_INFO |
cassyarduino | 15:97bc2d681e36 | 21 | //#define ACTLOGLEVEL LOG_DEBUG_V3 |
cassyarduino | 0:e3fb1267e3c3 | 22 | |
cassyarduino | 0:e3fb1267e3c3 | 23 | #if ACTLOGLEVEL>LOG_NONE |
cassyarduino | 0:e3fb1267e3c3 | 24 | #if defined(ARDUINO) |
cassyarduino | 0:e3fb1267e3c3 | 25 | #include "HardwareSerial.h" |
cassyarduino | 0:e3fb1267e3c3 | 26 | #if defined(__STM32F1__) || defined(__STM32F3__) || defined(__STM32F4__) |
cassyarduino | 0:e3fb1267e3c3 | 27 | #define LogObject Serial1 |
cassyarduino | 0:e3fb1267e3c3 | 28 | #else |
cassyarduino | 0:e3fb1267e3c3 | 29 | #define LogObject Serial |
cassyarduino | 0:e3fb1267e3c3 | 30 | #endif |
cassyarduino | 0:e3fb1267e3c3 | 31 | #define uart_send_str(x) print(x) |
cassyarduino | 0:e3fb1267e3c3 | 32 | #define uart_send_strln(x) println(x) |
cassyarduino | 0:e3fb1267e3c3 | 33 | #define uart_send_dec(x) print(x) |
cassyarduino | 0:e3fb1267e3c3 | 34 | #define uart_send_decln(x) println(x) |
cassyarduino | 0:e3fb1267e3c3 | 35 | #define uart_send_hex(x) print(x,HEX) |
cassyarduino | 0:e3fb1267e3c3 | 36 | #define uart_send_hexln(x) println(x,HEX) |
cassyarduino | 0:e3fb1267e3c3 | 37 | #define uart_send_bin(x) print(x,BIN) |
cassyarduino | 0:e3fb1267e3c3 | 38 | #define uart_send_binln(x) println(x,BIN) |
cassyarduino | 0:e3fb1267e3c3 | 39 | #define uart_send_buf_len(buf,len) write(buf,len) |
cassyarduino | 0:e3fb1267e3c3 | 40 | #endif |
cassyarduino | 0:e3fb1267e3c3 | 41 | #if defined(__MBED__) |
cassyarduino | 0:e3fb1267e3c3 | 42 | #include <mbed.h> |
cassyarduino | 9:312e0937630f | 43 | #include "mbed/Print.h" |
cassyarduino | 0:e3fb1267e3c3 | 44 | extern Serial LogObject; |
cassyarduino | 0:e3fb1267e3c3 | 45 | #define uart_send_str(x) printf("%s",x) |
cassyarduino | 15:97bc2d681e36 | 46 | #define uart_send_strln(x) printf("%s\r\n",x) |
cassyarduino | 0:e3fb1267e3c3 | 47 | #define uart_send_dec(x) printf("%d",x) |
cassyarduino | 15:97bc2d681e36 | 48 | #define uart_send_decln(x) printf("%d\r\n",x) |
cassyarduino | 0:e3fb1267e3c3 | 49 | #define uart_send_hex(x) printf("%X",x) |
cassyarduino | 15:97bc2d681e36 | 50 | #define uart_send_hexln(x) printf("%X\r\n",x) |
cassyarduino | 0:e3fb1267e3c3 | 51 | #define uart_send_bin(x) printf("%B",x) |
cassyarduino | 15:97bc2d681e36 | 52 | #define uart_send_binln(x) printf("%B\r\n",x) |
cassyarduino | 0:e3fb1267e3c3 | 53 | #define uart_send_buf_len(buf,len) printf("%.*s",len,buf); |
cassyarduino | 24:fb407a7f57bb | 54 | |
cassyarduino | 24:fb407a7f57bb | 55 | #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal))) |
cassyarduino | 0:e3fb1267e3c3 | 56 | #endif |
cassyarduino | 0:e3fb1267e3c3 | 57 | #endif |
cassyarduino | 0:e3fb1267e3c3 | 58 | |
cassyarduino | 21:c4439c50a5af | 59 | #if defined(ARDUINO) |
cassyarduino | 21:c4439c50a5af | 60 | #if defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(__STM32F4__) |
cassyarduino | 21:c4439c50a5af | 61 | #define F(x) (const char *)(x) |
cassyarduino | 21:c4439c50a5af | 62 | #define FP(x) (const char *)(x) |
cassyarduino | 21:c4439c50a5af | 63 | #else |
cassyarduino | 21:c4439c50a5af | 64 | #define FP(x) (__FlashStringHelper*)(x) // Helper |
cassyarduino | 21:c4439c50a5af | 65 | #endif |
cassyarduino | 21:c4439c50a5af | 66 | #endif |
cassyarduino | 0:e3fb1267e3c3 | 67 | |
cassyarduino | 0:e3fb1267e3c3 | 68 | #endif |