wayne roberts / lorawan1v1

Dependencies:   sx12xx_hal

Dependents:   LoRaWAN-SanJose_Bootcamp LoRaWAN-grove-cayenne LoRaWAN-classC-demo LoRaWAN-grove-cayenne ... more

Committer:
Wayne Roberts
Date:
Wed Feb 28 10:48:11 2018 -0800
Revision:
0:6b3ac9c5a042
Child:
4:e4bfe9183f94
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 0:6b3ac9c5a042 1 #include "mbed.h"
Wayne Roberts 0:6b3ac9c5a042 2 #ifdef MBED_DEBUG
Wayne Roberts 0:6b3ac9c5a042 3 #error mbed_debug
Wayne Roberts 0:6b3ac9c5a042 4 #endif
Wayne Roberts 0:6b3ac9c5a042 5 #include "utilities.h"
Wayne Roberts 0:6b3ac9c5a042 6 #include "eeprom.h"
Wayne Roberts 0:6b3ac9c5a042 7 #include "Commissioning.h"
Wayne Roberts 0:6b3ac9c5a042 8 #define __STDC_FORMAT_MACROS
Wayne Roberts 0:6b3ac9c5a042 9 #include <inttypes.h>
Wayne Roberts 0:6b3ac9c5a042 10 #include <stdlib.h>
Wayne Roberts 0:6b3ac9c5a042 11
Wayne Roberts 0:6b3ac9c5a042 12 #include "target.h"
Wayne Roberts 0:6b3ac9c5a042 13
Wayne Roberts 0:6b3ac9c5a042 14 #if defined( USE_BAND_868 )
Wayne Roberts 0:6b3ac9c5a042 15 #define DUTY_ENABLE
Wayne Roberts 0:6b3ac9c5a042 16 #include "duty.h"
Wayne Roberts 0:6b3ac9c5a042 17 #endif
Wayne Roberts 0:6b3ac9c5a042 18
Wayne Roberts 0:6b3ac9c5a042 19 #ifndef ENABLE_VT100
Wayne Roberts 0:6b3ac9c5a042 20 extern RawSerial pc;
Wayne Roberts 0:6b3ac9c5a042 21 #define APP_DEBUG
Wayne Roberts 0:6b3ac9c5a042 22 //#define MAC_DEBUG
Wayne Roberts 0:6b3ac9c5a042 23 //#define CRYPT_DEBUG
Wayne Roberts 0:6b3ac9c5a042 24 //#define MIC_DEBUG_DOWN
Wayne Roberts 0:6b3ac9c5a042 25 //#define DEBUG_MAC_CMD
Wayne Roberts 0:6b3ac9c5a042 26 #endif /* ENABLE_VT100 */
Wayne Roberts 0:6b3ac9c5a042 27 //#define MIC_DEBUG_UP
Wayne Roberts 0:6b3ac9c5a042 28 //#define MIC_DEBUG_DOWN
Wayne Roberts 0:6b3ac9c5a042 29
Wayne Roberts 0:6b3ac9c5a042 30 #ifdef APP_DEBUG
Wayne Roberts 0:6b3ac9c5a042 31 #define APP_PRINTF(...) pc.printf("\e[33m" __VA_ARGS__); pc.printf("\e[0m") /* yellow */
Wayne Roberts 0:6b3ac9c5a042 32 #else
Wayne Roberts 0:6b3ac9c5a042 33 #define APP_PRINTF(...)
Wayne Roberts 0:6b3ac9c5a042 34 #endif
Wayne Roberts 0:6b3ac9c5a042 35
Wayne Roberts 0:6b3ac9c5a042 36 #ifdef MAC_DEBUG
Wayne Roberts 0:6b3ac9c5a042 37 #define DEBUG_MAC_BUF(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 38 #define MAC_PRINTF(...) pc.printf("\e[36m" __VA_ARGS__); pc.printf("\e[0m") /* cyan */
Wayne Roberts 0:6b3ac9c5a042 39 #else
Wayne Roberts 0:6b3ac9c5a042 40 #define DEBUG_MAC_BUF(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 41 #define MAC_PRINTF(...)
Wayne Roberts 0:6b3ac9c5a042 42 #endif
Wayne Roberts 0:6b3ac9c5a042 43
Wayne Roberts 0:6b3ac9c5a042 44 #ifdef CRYPT_DEBUG
Wayne Roberts 0:6b3ac9c5a042 45 #define DEBUG_CRYPT_BUF(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 46 #define DEBUG_CRYPT(...) pc.printf(__VA_ARGS__)
Wayne Roberts 0:6b3ac9c5a042 47 #else
Wayne Roberts 0:6b3ac9c5a042 48 #define DEBUG_CRYPT_BUF(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 49 #define DEBUG_CRYPT(...)
Wayne Roberts 0:6b3ac9c5a042 50 #endif
Wayne Roberts 0:6b3ac9c5a042 51
Wayne Roberts 0:6b3ac9c5a042 52 #ifdef MIC_DEBUG_DOWN
Wayne Roberts 0:6b3ac9c5a042 53 #ifdef ENABLE_VT100
Wayne Roberts 0:6b3ac9c5a042 54 #define DEBUG_MIC_BUF_DOWN(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 55 #define DEBUG_MIC_DOWN(...) vt.SetCursorPos(ROW_MIC, 1); vt.printf(__VA_ARGS__)
Wayne Roberts 0:6b3ac9c5a042 56 #else
Wayne Roberts 0:6b3ac9c5a042 57 #define DEBUG_MIC_BUF_DOWN(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 58 #define DEBUG_MIC_DOWN(...) pc.printf(__VA_ARGS__)
Wayne Roberts 0:6b3ac9c5a042 59 #endif
Wayne Roberts 0:6b3ac9c5a042 60 #else
Wayne Roberts 0:6b3ac9c5a042 61 #define DEBUG_MIC_BUF_DOWN(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 62 #define DEBUG_MIC_DOWN(...)
Wayne Roberts 0:6b3ac9c5a042 63 #endif
Wayne Roberts 0:6b3ac9c5a042 64
Wayne Roberts 0:6b3ac9c5a042 65
Wayne Roberts 0:6b3ac9c5a042 66 #ifdef MIC_DEBUG_UP
Wayne Roberts 0:6b3ac9c5a042 67 #ifdef ENABLE_VT100
Wayne Roberts 0:6b3ac9c5a042 68 #define DEBUG_MIC_BUF_UP(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 69 #define DEBUG_MIC_UP(...) vt.SetCursorPos(ROW_MIC, 1); vt.printf(__VA_ARGS__)
Wayne Roberts 0:6b3ac9c5a042 70 #else
Wayne Roberts 0:6b3ac9c5a042 71 #define DEBUG_MIC_BUF_UP(w,x,y,z) print_buf(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 72 #define DEBUG_MIC_UP(...) pc.printf(__VA_ARGS__)
Wayne Roberts 0:6b3ac9c5a042 73 #endif
Wayne Roberts 0:6b3ac9c5a042 74 #else
Wayne Roberts 0:6b3ac9c5a042 75 #define DEBUG_MIC_BUF_UP(w,x,y,z)
Wayne Roberts 0:6b3ac9c5a042 76 #define DEBUG_MIC_UP(...)
Wayne Roberts 0:6b3ac9c5a042 77 #endif
Wayne Roberts 0:6b3ac9c5a042 78
Wayne Roberts 0:6b3ac9c5a042 79 #ifdef DEBUG_MAC_CMD
Wayne Roberts 0:6b3ac9c5a042 80 #define MACC_PRINTF(...) pc.printf("\e[0m");
Wayne Roberts 0:6b3ac9c5a042 81 #else
Wayne Roberts 0:6b3ac9c5a042 82 #define MACC_PRINTF(...)
Wayne Roberts 0:6b3ac9c5a042 83 #endif
Wayne Roberts 0:6b3ac9c5a042 84
Wayne Roberts 0:6b3ac9c5a042 85
Wayne Roberts 0:6b3ac9c5a042 86 uint8_t BoardGetBatteryLevel(void);