Multitech xDot AT Firmware

Dependencies:   MTS-Serial libxDot-mbed5

Files at this revision

API Documentation at this revision

Comitter:
Mike Fiore
Date:
Fri Jan 29 14:01:05 2016 -0600
Parent:
5:59f60bedc6df
Child:
7:3c97f3048373
Commit message:
update to AT firmware version 0.1.4

Changed in this revision

CommandTerminal/CmdCRC.cpp Show annotated file Show diff for this revision Revisions of this file
CommandTerminal/CmdRxFrequency.cpp Show annotated file Show diff for this revision Revisions of this file
CommandTerminal/CommandTerminal.cpp Show annotated file Show diff for this revision Revisions of this file
doc/mDot-AT-commands.txt Show annotated file Show diff for this revision Revisions of this file
doc/mdot-at-commands.txt Show diff for this revision Revisions of this file
version.h Show annotated file Show diff for this revision Revisions of this file
wakeup.c Show diff for this revision Revisions of this file
wakeup.h Show diff for this revision Revisions of this file
--- a/CommandTerminal/CmdCRC.cpp	Tue Aug 18 16:31:53 2015 +0000
+++ b/CommandTerminal/CmdCRC.cpp	Fri Jan 29 14:01:05 2016 -0600
@@ -1,7 +1,7 @@
 #include "CmdCRC.h"
 
 CmdCRC::CmdCRC(mDot* dot, mts::MTSSerial& serial) :
-        Command(dot, "CRC Checking ", "AT+CRC", "Enable/disable CRC checking of received packets. (0: off, 1: on)"), _serial(serial)
+        Command(dot, "CRC Checking ", "AT+CRC", "Enable/disable CRC (0: off, 1: on)"), _serial(serial)
 {
     _help = std::string(text()) + ": " + std::string(desc());
     _usage = "(0,1)";
--- a/CommandTerminal/CmdRxFrequency.cpp	Tue Aug 18 16:31:53 2015 +0000
+++ b/CommandTerminal/CmdRxFrequency.cpp	Fri Jan 29 14:01:05 2016 -0600
@@ -49,8 +49,6 @@
             return false;
         }
 
-        DEBUG_PRINTF("FREQ MIN: %lu MAX: %lu\r\n", _dot->getMinFrequency(), _dot->getMaxFrequency());
-
         if (frequency != 0 && (frequency < _dot->getMinFrequency() || frequency > _dot->getMaxFrequency())) {
             if (_dot->getFrequencyBand() == mDot::FB_868)
                 setErrorMessage("Invalid timeout, expects (0,863000000-870000000)"); 
--- a/CommandTerminal/CommandTerminal.cpp	Tue Aug 18 16:31:53 2015 +0000
+++ b/CommandTerminal/CommandTerminal.cpp	Fri Jan 29 14:01:05 2016 -0600
@@ -207,7 +207,7 @@
     else
         max_send_size = mDot::MaxLengths_868[_dot->getTxDataRate()];
 
-    DEBUG_PRINTF("Awake\r\n");
+    logDebug("Awake\r\n");
     wakeup(_sleep_standby);
 
     char ch;
@@ -226,7 +226,7 @@
 
         if (escape_buffer.length() == 3 && escape_buffer.find(escape_sequence) == 0) {
             _mode = mDot::COMMAND_MODE;
-            DEBUG_PRINTF("Exit serial mode\r\n");
+            logDebug("Exit serial mode\r\n");
             escape_timer.stop();
             escape_buffer.clear();
             write(done);
@@ -235,10 +235,16 @@
     }
 
     if (_serial_up) {
-        osDelay(_dot->getWakeDelay());
+        serial_read_timer.start();
+        uint32_t timeout = _dot->getWakeDelay();
 
-        serial_read_timer.start();
-        uint16_t timeout = _dot->getWakeTimeout();
+        // wait for timeout or start of serial data
+        while (!readable() && serial_read_timer.read_ms() < timeout) {
+            osDelay(10);
+        }
+
+        serial_read_timer.reset();
+        timeout = _dot->getWakeTimeout();
         while (_serial_up && serial_read_timer.read_ms() < timeout) {
             while (readable() && serial_buffer.size() < max_send_size) {
                 serial_buffer.push_back(read());
@@ -252,19 +258,19 @@
             _xbee_on_sleep = GPIO_PIN_RESET;
             if (!_dot->getIsTransmitting()) {
                 std::vector<uint8_t> recv_buffer;
-                DEBUG_PRINTF("Received serial data, sending out radio.\r\n");
+                logDebug("Received serial data, sending out radio.\r\n");
 
                 if (_dot->send(serial_buffer) != mDot::MDOT_OK)
-                    DEBUG_PRINTF("Send failed.\r\n");
+                    logDebug("Send failed.\r\n");
                 if (_dot->recv(recv_buffer))
                     _serial.writef("%s\r\n", formatPacketData(recv_buffer, _dot->getRxOutput()).c_str());
             } else {
-                DEBUG_PRINTF("Radio is busy, cannot send.\r\n");
+                logDebug("Radio is busy, cannot send.\r\n");
             }
 
             serial_buffer.clear();
         } else {
-            DEBUG_PRINTF("No data received from serial to send.\r\n");
+            logDebug("No data received from serial to send.\r\n");
         }
         _serial_up = false;
     }
@@ -321,7 +327,7 @@
 
             if (_dot->getFrequencyBand() == mDot::FB_915) {
                 uint8_t band = ((_dot->getFrequencySubBand()) % 8) + 1;
-                DEBUG_PRINTF("Join retries exhausted, switching to sub band %u\r\n", band);
+                logDebug("Join retries exhausted, switching to sub band %u\r\n", band);
                 _dot->setFrequencySubBand(band);
             }
 
@@ -546,7 +552,7 @@
             _dot->setVerbose(true);
             write(done);
         } else if (args[0] == "AT+SD") {
-            DEBUG_PRINTF("Enter Serial Mode\r\n");
+            logDebug("Enter Serial Mode\r\n");
             _mode = mDot::SERIAL_MODE;
         } else if (args[0] == "AT+SLEEP") {
             if (args.size() > 1 && (args[1] != "?")) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/mDot-AT-commands.txt	Fri Jan 29 14:01:05 2016 -0600
@@ -0,0 +1,106 @@
+# vim: expandtab sts=8 sw=8 ts=8
+Command         Name                            Description
+
+General commands
+----------------
+Command         Name                    Description
+
+AT              Attention               Attention
+ATI             Request Id              Request Identification
+ATZ             Reset CPU               Reset the CPU
+ATE0/1          Enable/Disable Echo     ATE0: disable, ATE1: enable
+ATV0/1          Enable/Disable Verbose  ATV0: disable, ATV1: enable
+AT&F            Reset Factory Defaults  Reset current configuration to factory defaults
+AT&W            Save Configuration      Save configuration to flash memory
+AT&V            Display Settings        Displays current settings and status
+AT&S            Display Stats           Display statistics
+AT&R            Reset Stats             Reset statistics
+AT+IPR          Serial Baud Rate        Set serial baud rate, default: 115200 
+AT+DIPR         Debug Baud Rate         Set debug serial baud rate, default: 115200 
+AT+SMODE        Start Up Mode           0: AT command mode, 1: Serial data mode
+AT+LOG			Debug Log Level			Enable/disable debug logging. (0: off, 1:Fatal - 6:Trace)
+
+Network/Addressing commands
+---------------------------
+
+AT+FREQ         Frequency Band          Configured Frequency Band '868' or '915'
+AT+FSB          Frequency Sub-band      Set the frequency sub-band for US 915, (0:ALL, 1-8)
+AT+PN           Public Network          Enable/disable public network mode. (0: off, 1: on)
+AT+DI           Device ID               Device EUI (unique, set at factory) (8 bytes)
+AT+NA           Network Address         Network address (devAddr in LoraMac) (4 bytes)
+AT+NSK          Network Session Key     Network session encryption key (16 bytes)
+AT+DSK          Data Session Key        Data session encryption key (16 bytes)
+AT+NK           Network Key             Configured network key/passphrase (App Key in LoraMac) ##  AT+NK=0,hex  AT+NK=1,passphrase (Net key = cmac(passphrase)) (16 bytes)
+AT+NI           Network ID              Configured Network EUI/Name (App EUI in LoraMac) AT+NI=0,hex AT+NI=1,network_name  (Net ID = crc64(network_name)) (8 bytes)
+AT+JOIN         Join Network            Join network (acquire network address and session keys)
+AT+JR			Join Retries			Number of times to retry joining the network in an attempt (0 - 255)
+AT+JBO			Join Byte Order			Send EUI's in join request with configured byte ordering 
+AT+NJM          Network Join Mode       0: Manual configuration, 1: OTA Network Join, 2: Auto OTA Network Join on start up (default: 1)
+AT+NJS          Network Join Status     0: Not joined, 1: Joined
+AT+NLC          Network Link Check      Perform network link check, displays dBm above floor, number of gateways in range and optional packet payload if received
+AT+LCC          Link Check Count        Set number of packets between each link check if ACK's are disabled
+AT+LCT          Link Check Threshold    Set threshold for number of link check of ACK failures to tolerate, (0: off, N: number of failures)
+AT+ENC          AES Encryption          Enable/disable AES encryption (0: off, 1: on)
+AT+RSSI         Signal Strength         Displays signal strength of received packets, last,min,max,avg
+AT+SNR          Signal To Noise Ratio   Display signal to noise ratio received packets last,min,max,avg
+AT+DP           Data Pending            Indicator of data in queue on server
+AT+PING         Send Ping               Sends ping, displays RSSI and SNR from gateway on pong
+
+Radio Configuration
+-------------------
+
+AT+TXDR         Tx Data Rate            Set the Tx data rate for all channels
+AT+TXP          Tx Power                Set the Tx power for all channels
+AT+TXF          Tx Frequency            Set Tx frequency
+AT+TXI          Set Tx inverted         Set Tx signal inverted, (default:off)
+AT+TXW          Tx Wait                 Enable/disable waiting for rx windows to expire after send. (0: off, 1: on)
+AT+TXCH         Tx Channels             List Tx channel frequencies for sub-band
+AT+RXDR         Rx Data Rate            Set the Rx data rate
+AT+RXF          Rx Frequency            Set the Rx frequency for +RECV,+RECVC
+AT+RXO          Rx Output               Set the Rx output type (0:hexadecimal, 1:raw)
+AT+RXI          Set Rx inverted         Set Rx signal inverted, (default:on)
+AT+FEC          Error Correction        Configure Forward Error Correction bytes (1 to 4)
+AT+CRC          CRC Checking            Enable/disable CRC checking of received packets. (0: off, 1: on)
+AT+ADR          Adaptive Data Rate      Enable/disable Adaptive Data Rate (0: off, 1: on)
+
+
+Send/Receive
+------------
+
+AT+ACK          Require ACK             Enable to require send acknowledgment (0: off, N: number of retries until ACK recevied)
+AT+SEND         Send Once               Sends supplied packet data one time and return response, (max:240 bytes)
+AT+SENDH        Send Once High BW       Sends supplied packet data one time and return response using High Bandwidth channel, (max:240 bytes)
+AT+SENDB        Send Binary             Sends supplied binary (hex) packet data one time and return response
+AT+SENDI        Send Continuous         Sends supplied packet data on interval between sends, output any received packets (escape sequence: +++)
+AT+RECV         Receive Once            Display last received packet
+AT+RECVC        Receive Continuous      Continuously receive and display packets, optional timeout in ms overrides configured Rx Timeout. (escape sequence: +++)
+AT+TXN			Tx Next					Get time in ms until next free channel
+AT+TOA          Time on air             Get time in ms of packet tx with current datarate
+
+
+Sleep/Serial data mode options
+------------------------
+
+AT+SD           Serial Data Mode        Reads serial data, sends Lora packets, then sleeps
+AT+SLEEP        Sleep Mode              Put mDot into sleep mode, (0:stop,1:standby)
+AT+WM           Wake Mode               Wakeup mode (0:INTERVAL,1:INTERRUPT)
+AT+WI           Wake Interval           Wakeup interval (seconds)
+AT+WP           Wake Pin                Wakeup DIO pin of sleep mode (default: DI8), deep-sleep uses DIO7
+AT+WD           Wake Delay              Time to wait for data after wakeup signal  (milliseconds)
+AT+WTO          Wake Timeout            Read serial data until timeout (milliseconds)
+
+
+MultiTech Debug
+---------------
+AT+SENDC        Send Continuous         Send un-modulated data continuously
+AT+DREGS        Dump Regs               Dump the SX1272 register values
+AT+ERASE        Erase entire flash      Erase all configurations saved in flash memory
+AT&WP           Write Protected Config  Write protected config to flash (DeviceId and Frequency Band)
+
+
+Possible Future commands
+------------------------
+AT+DIO0         Read/write DIO pins (conform to Xbee?)
+AT+AD0          Read analog input pins
+AT+SRS          Serial receive size             Read N bytes at a time for serial data mode
+Peer to Peer mode
--- a/doc/mdot-at-commands.txt	Tue Aug 18 16:31:53 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-# vim: expandtab sts=8 sw=8 ts=8
-Command         Name                            Description
-
-General commands
-----------------
-Command         Name                    Description
-
-AT              Attention               Attention
-ATI             Request Id              Request Identification
-ATZ             Reset CPU               Reset the CPU
-ATE0/1          Enable/Disable Echo     ATE0: disable, ATE1: enable
-ATV0/1          Enable/Disable Verbose  ATV0: disable, ATV1: enable
-AT&F            Reset Factory Defaults  Reset current configuration to factory defaults
-AT&W            Save Configuration      Save configuration to flash memory
-AT&V            Display Settings        Displays current settings and status
-AT+IPR          Serial Baud Rate        Set serial baud rate, default: 115200 
-AT+DIPR         Debug Baud Rate         Set debug serial baud rate, default: 115200 
-AT+SMODE        Start Up Mode           0: AT command mode, 1: Serial data mode
-AT+LOG          Debug Log Level         Enable/disable debug logging. (0: off, 1:Fatal - 6:Trace)
-
-Network/Addressing commands
----------------------------
-
-AT+FREQ         Frequency Band          Configured Frequency Band '868' or '915'
-AT+FSB          Frequency Sub-band      Set the frequency sub-band for US 915, (0:ALL, 1-8)
-AT+PN           Public Network          Enable/disable public network mode. (0: off, 1: on)
-AT+DI           Device ID               Device EUI (unique, set at factory) (8 bytes)
-AT+NA           Network Address         Network address (devAddr in LoraMac) (4 bytes)
-AT+NSK          Network Session Key     Network session encryption key (16 bytes)
-AT+DSK          Data Session Key        Data session encryption key (16 bytes)
-AT+NK           Network Key             Configured network key/passphrase (App Key in LoraMac) ##  AT+NK=0,hex  AT+NK=1,passphrase (Net key = cmac(passphrase)) (16 bytes)
-AT+NI           Network ID              Configured Network EUI/Name (App EUI in LoraMac) AT+NI=0,hex AT+NI=1,network_name  (Net ID = crc64(network_name)) (8 bytes)
-AT+JOIN         Join Network            Join network (acquire network address and session keys)
-AT+NJM          Network Join Mode       0: Manual configuration, 1: OTA Network Join, 2: Auto OTA Network Join on start up (default: 1)
-AT+NJS          Network Join Status     0: Not joined, 1: Joined
-AT+NLC          Network Link Check      Perform network link check, displays dBm above floor, number of gateways in range and optional packet payload if received
-AT+LCC          Link Check Count        Set number of packets between each link check if ACK's are disabled
-AT+ENC          AES Encryption          Enable/disable AES encryption (0: off, 1: on)
-AT+RSSI         Signal Strength         Displays signal strength of received packets, last,min,max,avg
-AT+SNR          Signal To Noise Ratio   Display signal to noise ratio received packets last,min,max,avg
-AT+DP           Data Pending            Indicator of data in queue on server
-AT+PING         Send Ping               Sends ping, displays RSSI and SNR from gateway on pong
-
-Radio Configuration
--------------------
-
-AT+TXDR         Tx Data Rate            Set the Tx data rate for all channels
-AT+TXP          Tx Power                Set the Tx power for all channels
-AT+TXF          Tx Frequency            Set Tx frequency
-AT+TXI          Set Tx inverted         Set Tx signal inverted, (default:off)
-AT+TXCH         Tx Channels             List Tx channel frequencies for sub-band
-AT+RXDR         Rx Data Rate            Set the Rx data rate
-AT+RXF          Rx Frequency            Set the Rx frequency for +RECV,+RECVC
-AT+RXO          Rx Output               Set the Rx output type (0:hexadecimal, 1:binary)
-AT+RXI          Set Rx inverted         Set Rx signal inverted, (default:on)
-AT+FEC          Error Correction        Configure Forward Error Correction bytes (1 to 4)
-AT+CRC          CRC Checking            Enable/disable CRC checking of received packets. (0: off, 1: on)
-AT+ADR          Adaptive Data Rate      Enable/disable Adaptive Data Rate (0: off, 1: on)
-
-
-Send/Receive
-------------
-
-AT+ACK          Require ACK             Enable to require send acknowledgement (0: off, N: number of retries until ACK recevied)
-AT+SEND         Send Once               Sends supplied packet data one time and return response, (max:240 bytes)
-AT+SENDH        Send Once High BW       Sends supplied packet data one time and return response using High Bandwidth channel, (max:240 bytes)
-AT+SENDB        Send Binary             Sends supplied binary (hex) packet data one time and return response
-AT+SENDI        Send Continuous         Sends supplied packet data on interval between sends, output any recevied packets (escape sequence: +++)
-AT+RECV         Receive Once            Receive and display one packet, optional timeout in ms overrides configured Rx Timeout.
-AT+RECVC        Receive Continuous      Continously receive and display packets, optional timeout in ms overrides configured Rx Timeout. (escape sequence: +++)
-AT+TXN          Tx Next                 Get time in ms until next free channel
-
-Serial data mode options
-------------------------
-
-AT+SD           Serial Data Mode        Reads serial data and sends Lora packets (escape sequence: +++)
-AT+SDWI         Serial Wake Interval    Serial data wakeup interval to generate wake signal (seconds)
-AT+SDWD         Serial Wake Delay       Time to wait for data after wakeup signal  (milliseconds)
-AT+SDTO         Serial Receive Timeout  Read serial data until timeout (milliseconds)
--- a/version.h	Tue Aug 18 16:31:53 2015 +0000
+++ b/version.h	Fri Jan 29 14:01:05 2016 -0600
@@ -1,6 +1,6 @@
 #ifndef __VERSION_H__
 #define __VERSION_H__
 
-#define AT_APPLICATION_VERSION "0.1.2-mbed"
+#define AT_APPLICATION_VERSION "0.1.4-mbed"
 
 #endif
--- a/wakeup.c	Tue Aug 18 16:31:53 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-#include "stm32f4xx_hal.h"
-#include "wakeup.h"
-
-
-static int rtc_inited = 0;
-static uint32_t timeout = 10;
-
-uint32_t wakeup_init(uint32_t seconds) {
-    RCC_OscInitTypeDef RCC_OscInitStruct;
-    uint32_t rtc_freq = 0;
-
-    if (rtc_inited) {
-        if (timeout != seconds)   {
-            timeout = seconds;
-            HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, timeout, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
-        }
-        return 0;
-    }
-    rtc_inited = 1;
-
-    RtcHandle.Instance = RTC;
-
-    // Enable Power clock
-    __PWR_CLK_ENABLE();
-
-    // Enable access to Backup domain
-    HAL_PWR_EnableBkUpAccess();
-
-    uint32_t count = RTC_ReadBackupRegister(RTC_BKP_DR0);
-    printf("UPLINK: %lu\r\n", count);
-
-
-    // Reset Backup domain
-    __HAL_RCC_BACKUPRESET_FORCE();
-    __HAL_RCC_BACKUPRESET_RELEASE();
-
-    // Enable LSE Oscillator
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
-    RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE; /* Mandatory, otherwise the PLL is reconfigured! */
-    RCC_OscInitStruct.LSEState       = RCC_LSE_ON; /* External 32.768 kHz clock on OSC_IN/OSC_OUT */
-    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK) {
-        // Connect LSE to RTC
-        __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSE);
-        __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
-        rtc_freq = LSE_VALUE;
-    } else {
-        // Enable LSI clock
-        RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
-        RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
-        RCC_OscInitStruct.LSEState       = RCC_LSE_OFF;
-        RCC_OscInitStruct.LSIState       = RCC_LSI_ON;
-        if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
-            //error("RTC error: LSI clock initialization failed.");
-        }
-        // Connect LSI to RTC
-        __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSI);
-        __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
-        // [TODO] This value is LSI typical value. To be measured precisely using a timer input capture
-        rtc_freq = 32000;
-    }
-
-    // Enable RTC
-    __HAL_RCC_RTC_ENABLE();
-
-    RtcHandle.Init.HourFormat     = RTC_HOURFORMAT_24;
-    RtcHandle.Init.AsynchPrediv   = 127;
-    RtcHandle.Init.SynchPrediv    = (rtc_freq / 128) - 1;
-    RtcHandle.Init.OutPut         = RTC_OUTPUT_DISABLE;
-    RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
-    RtcHandle.Init.OutPutType     = RTC_OUTPUT_TYPE_OPENDRAIN;
-
-    if (HAL_RTC_Init(&RtcHandle) != HAL_OK) {
-        //error("RTC error: RTC initialization failed.");
-    }
-
-    timeout = seconds;
-    HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, timeout, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
-
-    return count;
-}
-
-void wakeup_clear(void)
-{
-    __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&RtcHandle, RTC_FLAG_WUTF);
-}
-
-uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
-{
-    __IO uint32_t tmp = 0;
-
-    // Check the parameters
-    assert_param(IS_RTC_BKP(RTC_BKP_DR));
-    tmp = RTC_BASE + 0x50;
-    tmp += (RTC_BKP_DR * 4);
-    // Read the specified register
-    return (*(__IO uint32_t *)tmp);
-}
-
-void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
-{
-    __IO uint32_t tmp = 0;
-
-    // Check the parameters/
-    assert_param(IS_RTC_BKP(RTC_BKP_DR));
-    tmp = RTC_BASE + 0x50;
-    tmp += (RTC_BKP_DR * 4);
-    // Write the specified register/
-    *(__IO uint32_t *)tmp = (uint32_t)Data;
-}
-
-
-uint8_t TM_WATCHDOG_Init(uint16_t reload) {
-    uint8_t result = 0;
-
-    /* Check if the system has resumed from IWDG reset */
-    if (RCC->CSR & (0x20000000)) {
-        /* Reset by IWDG */
-        result = 1;
-
-        /* Clear reset flags */
-        RCC->CSR |= RCC_CSR_RMVF;
-    }
-
-    /* Enable write access to IWDG_PR and IWDG_RLR registers */
-    IWDG->KR = 0x5555;
-
-    /* IWDG counter clock: LSI/32 = 1024Hz */
-    IWDG->PR = 0x03;
-
-    reload = 4095;
-
-    printf("WATCHDOG RELOAD: %lu\r\n", reload);
-    /* Set reload */
-    IWDG->RLR = reload;
-
-    /* Reload IWDG counter */
-    IWDG->KR = 0xAAAA;
-
-    /* Enable IWDG (the LSI oscillator will be enabled by hardware) */
-    IWDG->KR = 0xCCCC;
-
-    /* Return status */
-    return result;
-}
-
-void TM_WATCHDOG_Disable(void) {
-    IWDG->KR = 0x0000;
-}
-
-void TM_WATCHDOG_Reset(void) {
-    /* Reload IWDG counter */
-    IWDG->KR = 0xAAAA;
-}
--- a/wakeup.h	Tue Aug 18 16:31:53 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#ifndef __WAKEUP_H__
-#define __WAKEUP_H__
-
-#include <inttypes.h>
-
-uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
-
-void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
-
-static RTC_HandleTypeDef RtcHandle;
-
-uint32_t wakeup_init(uint32_t seconds);
-
-void wakeup_clear(void);
-
-
-#ifndef TM_WATCHDOG_H
-#define TM_WATCHDOG_H 110
-/**
- *  * @addtogroup TM_STM32F4xx_Libraries
- *   * @{
- *    */
-
-/**
- *  * @defgroup TM_WATCHDOG
- *   * @brief    Independent Watchdog timer for STM32F4xx - http://stm32f4-discovery.com/2014/07/library-20-independent-watchdog-timer-on-stm32f4xx/
- *    * @{
- *     *
- *      * \par Changelog
- *       *
- *       @verbatim
- *        Version 1.1
- *          - March 10, 2015
- *            - Support for STD/HAL drivers
- *             Version 1.0
- *               - First release
- *               @endverbatim
- *                *
- *                 * \par Dependencies
- *                  *
- *                  @verbatim
- *                   - STM32F4xx
- *                    - defines.h
- *                    @endverbatim
- *                     */
-
-/**
- *  * @defgroup TM_WATCHDOG_Typedefs
- *   * @brief    Library Typedefs
- *    * @{
- *     */
-
-/**
- *  * @brief Watchdog timeout settings
- *   */
-typedef enum {
-    TM_WATCHDOG_Timeout_5ms,    /*!< System reset called every 5ms */
-    TM_WATCHDOG_Timeout_10ms,   /*!< System reset called every 10ms */
-    TM_WATCHDOG_Timeout_15ms,   /*!< System reset called every 15ms */
-    TM_WATCHDOG_Timeout_30ms,   /*!< System reset called every 30ms */
-    TM_WATCHDOG_Timeout_60ms,   /*!< System reset called every 60ms */
-    TM_WATCHDOG_Timeout_120ms,  /*!< System reset called every 120ms */
-    TM_WATCHDOG_Timeout_250ms,  /*!< System reset called every 250ms */
-    TM_WATCHDOG_Timeout_500ms,  /*!< System reset called every 500ms */
-    TM_WATCHDOG_Timeout_1s,     /*!< System reset called every 1s */
-    TM_WATCHDOG_Timeout_2s,     /*!< System reset called every 2s */
-    TM_WATCHDOG_Timeout_4s      /*!< System reset called every 4s */
-} TM_WATCHDOG_Timeout_t;
-
-/**
- *  * @}
- *   */
-
-/**
- *  * @defgroup TM_WATCHDOG_Functions
- *   * @brief    Library Functions
- *    * @{
- *     */
-
-/**
- *  * @brief  Initialize Watchdog timer
- *   * @note   After you initialize it, you can't disable it unless reset occur.
- *    * @param  timeout. Timeout value when watchdog reset happen if not reset by user.
- *     *            This parameter can be a value of @ref TM_WATCHDOG_Timeout_t enumeration
- *      * @retval Value if system was reset because of watchdog timer
- *       *            - 1: Reset happen because of watchdog
- *        *            - 0: Otherwise
- *         *
- *          */
-uint8_t TM_WATCHDOG_Init(uint16_t reloa);
-
-/**
- *  * @brief  Reset Watchdog timer
- *   * @note   This function have to be called periodically to reset watchdog timer, or your system will reset
- *    * @param  None
- *     * @retval None
- *      */
-void TM_WATCHDOG_Reset(void);
-
-/**
- *  * @}
- *   */
-
-/**
- *  * @}
- *   */
-
-/**
- *  * @}
- *   */
-
-#endif
-
-#endif // __WAKEUP_H__