Program that uses the QuickStart Library to interface a SmartMesh IP mote: Connects to the default network and starts publishing a random walk value every 5 seconds.

Dependencies:   mbed millis

Fork of QSL_SimplePublish by Jon-Håkon Bøe Røli

QSL SimplePublish

SmartMesh IP QuickStart Library

Committer:
jhbr
Date:
Fri Nov 04 14:19:34 2016 +0000
Revision:
9:f723949a18b7
Parent:
8:8eb144b9ada3
Deactivated DEBUG prints and updated mbed library to v128

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhbr 0:d3f5fdf2e6da 1 /*
jhbr 0:d3f5fdf2e6da 2 Copyright (c) 2016, Dust Networks. All rights reserved.
jhbr 0:d3f5fdf2e6da 3
jhbr 0:d3f5fdf2e6da 4 Port of the time module to the NUCLEO-L053R8.
jhbr 0:d3f5fdf2e6da 5
jhbr 0:d3f5fdf2e6da 6 \license See attached DN_LICENSE.txt.
jhbr 0:d3f5fdf2e6da 7 */
jhbr 0:d3f5fdf2e6da 8
jhbr 0:d3f5fdf2e6da 9 #include "dn_time.h"
jhbr 0:d3f5fdf2e6da 10 #include "mbed.h"
jhbr 8:8eb144b9ada3 11 #include "millis.h"
jhbr 0:d3f5fdf2e6da 12 #include "dn_debug.h"
jhbr 0:d3f5fdf2e6da 13
jhbr 4:0285bcbbc855 14 //=========================== defines =========================================
jhbr 4:0285bcbbc855 15
jhbr 4:0285bcbbc855 16
jhbr 0:d3f5fdf2e6da 17 //=========================== variables =======================================
jhbr 0:d3f5fdf2e6da 18
jhbr 0:d3f5fdf2e6da 19
jhbr 0:d3f5fdf2e6da 20 //=========================== prototypes ======================================
jhbr 0:d3f5fdf2e6da 21
jhbr 0:d3f5fdf2e6da 22
jhbr 0:d3f5fdf2e6da 23 //=========================== public ==========================================
jhbr 0:d3f5fdf2e6da 24
jhbr 0:d3f5fdf2e6da 25 uint32_t dn_time_ms(void)
jhbr 0:d3f5fdf2e6da 26 {
jhbr 3:fb2c485306d1 27 /*
jhbr 8:8eb144b9ada3 28 A simple library that utilize SysTick is used instead of the mbed Timer
jhbr 8:8eb144b9ada3 29 class, as the latter is based on 32-bit microsecond counter and thus
jhbr 8:8eb144b9ada3 30 overflows long before 32-bits of milliseconds are used.
jhbr 8:8eb144b9ada3 31 */
jhbr 8:8eb144b9ada3 32 uint32_t ms = millis();
jhbr 3:fb2c485306d1 33 return ms;
jhbr 0:d3f5fdf2e6da 34 }
jhbr 0:d3f5fdf2e6da 35
jhbr 0:d3f5fdf2e6da 36 void dn_sleep_ms(uint32_t milliseconds)
jhbr 0:d3f5fdf2e6da 37 {
jhbr 4:0285bcbbc855 38 /*
jhbr 4:0285bcbbc855 39 A simple delay is used for simplicity in this example.
jhbr 4:0285bcbbc855 40 To save power, we could instead have initialized a timer to fire an
jhbr 4:0285bcbbc855 41 interrupt after the set number of milliseconds, followed by entering
jhbr 4:0285bcbbc855 42 a low-power sleep mode. Upon wake up, we would have to check that we
jhbr 4:0285bcbbc855 43 were indeed woken by said interrupt (and e.g. not an USART interrupt)
jhbr 4:0285bcbbc855 44 to decide if we should go back to sleep or not.
jhbr 4:0285bcbbc855 45 */
jhbr 4:0285bcbbc855 46 wait_ms(milliseconds);
jhbr 0:d3f5fdf2e6da 47 }
jhbr 0:d3f5fdf2e6da 48
jhbr 0:d3f5fdf2e6da 49 //=========================== private =========================================
jhbr 0:d3f5fdf2e6da 50
jhbr 0:d3f5fdf2e6da 51
jhbr 0:d3f5fdf2e6da 52 //=========================== helpers =========================================
jhbr 0:d3f5fdf2e6da 53