Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dot_util.h Source File

dot_util.h

00001 #ifndef __DOT_UTIL_H__
00002 #define __DOT_UTIL_H__
00003 
00004 #include <inc/MyLog.h>
00005 #include "../config.h"
00006 #include "mbed.h"
00007 #include "mDot.h"
00008 #include "MTSText.h"
00009 #include "MTSLog.h"
00010 
00011 #define SHOW_SECRETS 0 // This will hide all the keys from printing
00012 
00013 extern mDot* dot;
00014 
00015 void display_config();
00016 
00017 void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, bool public_network, uint8_t ack);
00018 
00019 void update_ota_config_id_key(uint8_t *network_id, uint8_t *network_key, uint8_t frequency_sub_band, bool public_network, uint8_t ack);
00020 
00021 void update_manual_config(uint8_t *network_address, uint8_t *network_session_key, uint8_t *data_session_key, uint8_t frequency_sub_band, bool public_network, uint8_t ack);
00022 
00023 void update_peer_to_peer_config(uint8_t *network_address, uint8_t *network_session_key, uint8_t *data_session_key, uint32_t tx_frequency, uint8_t tx_datarate, uint8_t tx_power);
00024 
00025 void update_network_link_check_config(uint8_t link_check_count, uint8_t link_check_threshold);
00026 
00027 void join_network();
00028 
00029 void sleep_wake_rtc_only(bool deepsleep);
00030 
00031 void sleep_wake_interrupt_only(bool deepsleep);
00032 
00033 void sleep_wake_rtc_or_interrupt(bool deepsleep);
00034 
00035 void sleep_save_io();
00036 
00037 void sleep_configure_io();
00038 
00039 void sleep_restore_io();
00040 
00041 void send_data(std::vector<uint8_t> data);
00042 
00043 #ifdef MTS_DEBUG
00044 #define logFatal(format, ...) \
00045     mts::MTSLog::printMessage(mts::MTSLog::FATAL_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::FATAL_LABEL, ##__VA_ARGS__)
00046 #define logError(format, ...) \
00047     mts::MTSLog::printMessage(mts::MTSLog::ERROR_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::ERROR_LABEL, ##__VA_ARGS__)
00048 #define logWarning(format, ...) \
00049     mts::MTSLog::printMessage(mts::MTSLog::WARNING_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::WARNING_LABEL, ##__VA_ARGS__)
00050 #define logInfo(format, ...) \
00051     mts::MTSLog::printMessage(mts::MTSLog::INFO_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::INFO_LABEL, ##__VA_ARGS__)
00052 #define logDebug(format, ...) \
00053     mts::MTSLog::printMessage(mts::MTSLog::DEBUG_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::DEBUG_LABEL, ##__VA_ARGS__)
00054 #define logTrace(format, ...) \
00055     mts::MTSLog::printMessage(mts::MTSLog::TRACE_LEVEL, "%s:%s:%d| [%s] " format "\r\n", __CLASSNAME__, __func__, __LINE__, mts::MTSLog::TRACE_LABEL, ##__VA_ARGS__)
00056 #else
00057 #define mtsLogFatal(format, ...) \
00058     mts::MTSLog::printMessage(mts::MTSLog::FATAL_LEVEL, "[%s] " format "\r\n", mts::MTSLog::FATAL_LABEL, ##__VA_ARGS__)
00059 #define mtsLogError(format, ...) \
00060     mts::MTSLog::printMessage(mts::MTSLog::ERROR_LEVEL, "[%s] " format "\r\n", mts::MTSLog::ERROR_LABEL, ##__VA_ARGS__)
00061 #define mtsLogWarning(format, ...) \
00062     mts::MTSLog::printMessage(mts::MTSLog::WARNING_LEVEL, "[%s] " format "\r\n", mts::MTSLog::WARNING_LABEL, ##__VA_ARGS__)
00063 #define mtsLogInfo(format, ...) \
00064     mts::MTSLog::printMessage(mts::MTSLog::INFO_LEVEL, "[%s] " format "\r\n", mts::MTSLog::INFO_LABEL, ##__VA_ARGS__)
00065 #define mtsLogDebug(format, ...) \
00066     mts::MTSLog::printMessage(mts::MTSLog::DEBUG_LEVEL, "[%s] " format "\r\n", mts::MTSLog::DEBUG_LABEL, ##__VA_ARGS__)
00067 #define mtsLogTrace(format, ...) \
00068     mts::MTSLog::printMessage(mts::MTSLog::TRACE_LEVEL, "[%s] " format "\r\n", mts::MTSLog::TRACE_LABEL, ##__VA_ARGS__)
00069 #endif
00070 
00071 #endif