SmartMesh QSL for STM32F4 version

Fork of COG-AD4050_QSL by APS Lab

Committer:
APS_Lab
Date:
Thu Jul 12 09:19:12 2018 +0000
Revision:
1:b909b8399252
Parent:
0:8ca1e814a851
SmartMesh for STM32F4 version

Who changed what in which revision?

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