pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT
Dependencies: mbed MMA8451Q USBDevice WakeUp vt100
Fork of afero_node_suntory_2017_06_15 by
util/DebugIO.hpp@21:d03c7bbb9f37, 2017-06-09 (annotated)
- Committer:
- wataloh
- Date:
- Fri Jun 09 01:49:53 2017 +0000
- Revision:
- 21:d03c7bbb9f37
- Parent:
- 9:4d5ecf38636e
Added the following process; When VEML6040 library returns NACK, forces software reset
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wataloh | 2:dfe671e31221 | 1 | #ifndef _MARUSOL_DEBUG_IO_HPP_ |
wataloh | 2:dfe671e31221 | 2 | #define _MARUSOL_DEBUG_IO_HPP_ |
wataloh | 5:9d5c7ee80f3b | 3 | |
wataloh | 5:9d5c7ee80f3b | 4 | #if defined (TARGET_TEENSY3_1) |
wataloh | 5:9d5c7ee80f3b | 5 | #include "USBSerial.h" |
wataloh | 5:9d5c7ee80f3b | 6 | #else |
wataloh | 5:9d5c7ee80f3b | 7 | #include "mbed.h" |
wataloh | 2:dfe671e31221 | 8 | #endif |
wataloh | 2:dfe671e31221 | 9 | |
wataloh | 5:9d5c7ee80f3b | 10 | #include "Preferences.hpp" |
wataloh | 5:9d5c7ee80f3b | 11 | |
wataloh | 6:88cc04eb613a | 12 | #define SERIAL_PRINT_DBG_ON |
wataloh | 5:9d5c7ee80f3b | 13 | #ifdef SERIAL_PRINT_DBG_ON |
wataloh | 5:9d5c7ee80f3b | 14 | #define SERIAL_PRINT_DBG(...) (DebugIO::debugIO->printf(__VA_ARGS__)) |
wataloh | 5:9d5c7ee80f3b | 15 | #define SERIAL_PRINT_DBG_FUNCNAME() (DebugIO::debugIO->printf("%s,%d,%s\n",__FILE__,__LINE__,__PRETTY_FUNCTION__)) |
wataloh | 5:9d5c7ee80f3b | 16 | #else |
wataloh | 5:9d5c7ee80f3b | 17 | #define SERIAL_PRINT_DBG(...) |
wataloh | 5:9d5c7ee80f3b | 18 | #define SERIAL_PRINT_DBG_FUNCNAME() |
wataloh | 5:9d5c7ee80f3b | 19 | #endif //SERIAL_PRINT_DBG_ON |
wataloh | 5:9d5c7ee80f3b | 20 | |
wataloh | 9:4d5ecf38636e | 21 | //#define SERIAL_PRINT_DBG_ASR_ON |
wataloh | 5:9d5c7ee80f3b | 22 | #ifdef SERIAL_PRINT_DBG_ASR_ON |
wataloh | 5:9d5c7ee80f3b | 23 | #define SERIAL_PRINT_DBG_ASR(...) (DebugIO::debugIO->printf(__VA_ARGS__)) |
wataloh | 5:9d5c7ee80f3b | 24 | #else |
wataloh | 5:9d5c7ee80f3b | 25 | #define SERIAL_PRINT_DBG_ASR(...) |
wataloh | 5:9d5c7ee80f3b | 26 | #endif //SERIAL_PRINT_DBG_ASR_ON |
wataloh | 5:9d5c7ee80f3b | 27 | |
wataloh | 5:9d5c7ee80f3b | 28 | template<typename A> struct template_debug_io |
wataloh | 2:dfe671e31221 | 29 | { |
wataloh | 2:dfe671e31221 | 30 | #if defined (TARGET_KL25Z) |
wataloh | 5:9d5c7ee80f3b | 31 | static Serial *debugIO; |
wataloh | 2:dfe671e31221 | 32 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 5:9d5c7ee80f3b | 33 | static USBSerial *debugIO; |
wataloh | 2:dfe671e31221 | 34 | #endif |
wataloh | 2:dfe671e31221 | 35 | }; |
wataloh | 5:9d5c7ee80f3b | 36 | |
wataloh | 5:9d5c7ee80f3b | 37 | struct DebugIO : public template_debug_io<DebugIO> |
wataloh | 5:9d5c7ee80f3b | 38 | { |
wataloh | 5:9d5c7ee80f3b | 39 | static void init() |
wataloh | 5:9d5c7ee80f3b | 40 | { |
wataloh | 5:9d5c7ee80f3b | 41 | #if defined(SERIAL_PRINT_DBG_ON) || defined(SERIAL_PRINT_DBG_ASR_ON) |
wataloh | 5:9d5c7ee80f3b | 42 | #if defined (TARGET_KL25Z) |
wataloh | 5:9d5c7ee80f3b | 43 | debugIO = new Serial(USBTX, USBRX); |
wataloh | 21:d03c7bbb9f37 | 44 | debugIO->baud(PINS::UART::BAUD_RATE); |
wataloh | 5:9d5c7ee80f3b | 45 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 5:9d5c7ee80f3b | 46 | debugIO = new USBSerial(); |
wataloh | 5:9d5c7ee80f3b | 47 | #endif |
wataloh | 2:dfe671e31221 | 48 | #endif |
wataloh | 5:9d5c7ee80f3b | 49 | } |
wataloh | 5:9d5c7ee80f3b | 50 | static void test() |
wataloh | 5:9d5c7ee80f3b | 51 | { |
wataloh | 5:9d5c7ee80f3b | 52 | SERIAL_PRINT_DBG("%s\n","dbg"); |
wataloh | 5:9d5c7ee80f3b | 53 | SERIAL_PRINT_DBG_FUNCNAME(); |
wataloh | 5:9d5c7ee80f3b | 54 | SERIAL_PRINT_DBG_ASR("%s\n","dbg asr"); |
wataloh | 21:d03c7bbb9f37 | 55 | SERIAL_PRINT_DBG("baud rate:%ld\n",PINS::UART::BAUD_RATE); |
wataloh | 5:9d5c7ee80f3b | 56 | } |
wataloh | 5:9d5c7ee80f3b | 57 | }; |
wataloh | 5:9d5c7ee80f3b | 58 | |
wataloh | 5:9d5c7ee80f3b | 59 | #if defined (TARGET_KL25Z) |
wataloh | 5:9d5c7ee80f3b | 60 | template<> Serial *template_debug_io<DebugIO>::debugIO = NULL; |
wataloh | 5:9d5c7ee80f3b | 61 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 5:9d5c7ee80f3b | 62 | template<> USBSerial *template_debug_io<DebugIO>::debugIO = NULL; |
wataloh | 5:9d5c7ee80f3b | 63 | #endif |
wataloh | 5:9d5c7ee80f3b | 64 | |
wataloh | 2:dfe671e31221 | 65 | #endif //_MARUSOL_DEBUG_IO_HPP_ |