this is avaiable project

Dependents:   LoRaWAN_MBED

Fork of LoRaMacLib by LoRa All

Committer:
GregCr
Date:
Wed Aug 12 14:08:29 2015 +0000
Revision:
0:9be122c18509
First Implementation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:9be122c18509 1 /*
GregCr 0:9be122c18509 2 / _____) _ | |
GregCr 0:9be122c18509 3 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:9be122c18509 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:9be122c18509 5 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:9be122c18509 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:9be122c18509 7 (C)2013 Semtech
GregCr 0:9be122c18509 8
GregCr 0:9be122c18509 9 Description: Target board general functions implementation
GregCr 0:9be122c18509 10
GregCr 0:9be122c18509 11 License: Revised BSD License, see LICENSE.TXT file include in the project
GregCr 0:9be122c18509 12
GregCr 0:9be122c18509 13 Maintainer: Miguel Luis and Gregory Cristian
GregCr 0:9be122c18509 14 */
GregCr 0:9be122c18509 15 #include "board.h"
GregCr 0:9be122c18509 16
GregCr 0:9be122c18509 17 Timer TimeCounter;
GregCr 0:9be122c18509 18 Ticker LoadTimeCounter;
GregCr 0:9be122c18509 19
GregCr 0:9be122c18509 20
GregCr 0:9be122c18509 21 volatile uint32_t currentTime = 0;
GregCr 0:9be122c18509 22
GregCr 0:9be122c18509 23 void ResetTimecounter( void )
GregCr 0:9be122c18509 24 {
GregCr 0:9be122c18509 25 currentTime = currentTime + TimeCounter.read_us();
GregCr 0:9be122c18509 26 TimeCounter.reset();
GregCr 0:9be122c18509 27 TimeCounter.start( );
GregCr 0:9be122c18509 28 }
GregCr 0:9be122c18509 29
GregCr 0:9be122c18509 30 void TimerHwInit( void )
GregCr 0:9be122c18509 31 {
GregCr 0:9be122c18509 32 TimeCounter.start( );
GregCr 0:9be122c18509 33 LoadTimeCounter.attach( &ResetTimecounter, 10 );
GregCr 0:9be122c18509 34 }
GregCr 0:9be122c18509 35
GregCr 0:9be122c18509 36 TimerTime_t TimerGetCurrentTime( void )
GregCr 0:9be122c18509 37 {
GregCr 0:9be122c18509 38 currentTime += TimeCounter.read_us();
GregCr 0:9be122c18509 39 TimeCounter.reset();
GregCr 0:9be122c18509 40 TimeCounter.start( );
GregCr 0:9be122c18509 41 return ( ( TimerTime_t )currentTime );
GregCr 0:9be122c18509 42 }
GregCr 0:9be122c18509 43