for India band 30dBm LoRa Module, DSPLoRa based on code from Semtech and as modified by Sachin Pukale/ TCL/

Dependencies:   mbed Chainable_RGB_LED DigitDisplay LoRaWAN-lib SX1276Lib

Fork of DSP_LoRaWAN by Akshay Mishra

Committer:
akshaymishra
Date:
Thu Jan 05 03:47:15 2017 +0000
Revision:
7:5c0e1dfdf0c6
Parent:
0:cb80564f40e1
Address update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:cb80564f40e1 1 /*
mluis 0:cb80564f40e1 2 / _____) _ | |
mluis 0:cb80564f40e1 3 ( (____ _____ ____ _| |_ _____ ____| |__
mluis 0:cb80564f40e1 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 0:cb80564f40e1 5 _____) ) ____| | | || |_| ____( (___| | | |
mluis 0:cb80564f40e1 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 0:cb80564f40e1 7 (C)2013 Semtech
mluis 0:cb80564f40e1 8
mluis 0:cb80564f40e1 9 Description: Timer objects and scheduling management
mluis 0:cb80564f40e1 10
mluis 0:cb80564f40e1 11 License: Revised BSD License, see LICENSE.TXT file include in the project
mluis 0:cb80564f40e1 12
mluis 0:cb80564f40e1 13 Maintainer: Miguel Luis and Gregory Cristian
mluis 0:cb80564f40e1 14 */
mluis 0:cb80564f40e1 15 #include "board.h"
mluis 0:cb80564f40e1 16
mluis 0:cb80564f40e1 17 Timer TimeCounter;
mluis 0:cb80564f40e1 18 Ticker LoadTimeCounter;
mluis 0:cb80564f40e1 19
mluis 0:cb80564f40e1 20 volatile uint32_t CurrentTime = 0;
mluis 0:cb80564f40e1 21
mluis 0:cb80564f40e1 22 void TimerResetTimeCounter( void )
mluis 0:cb80564f40e1 23 {
mluis 0:cb80564f40e1 24 CurrentTime = CurrentTime + TimeCounter.read_us( );
mluis 0:cb80564f40e1 25 TimeCounter.reset( );
mluis 0:cb80564f40e1 26 TimeCounter.start( );
mluis 0:cb80564f40e1 27 }
mluis 0:cb80564f40e1 28
mluis 0:cb80564f40e1 29 void TimerTimeCounterInit( void )
mluis 0:cb80564f40e1 30 {
mluis 0:cb80564f40e1 31 TimeCounter.start( );
mluis 0:cb80564f40e1 32 LoadTimeCounter.attach( &TimerResetTimeCounter, 10 );
mluis 0:cb80564f40e1 33 }
mluis 0:cb80564f40e1 34
mluis 0:cb80564f40e1 35 TimerTime_t TimerGetCurrentTime( void )
mluis 0:cb80564f40e1 36 {
mluis 0:cb80564f40e1 37 CurrentTime += TimeCounter.read_us( );
mluis 0:cb80564f40e1 38 TimeCounter.reset( );
mluis 0:cb80564f40e1 39 TimeCounter.start( );
mluis 0:cb80564f40e1 40 return ( ( TimerTime_t )CurrentTime );
mluis 0:cb80564f40e1 41 }
mluis 0:cb80564f40e1 42
mluis 0:cb80564f40e1 43 void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) )
mluis 0:cb80564f40e1 44 {
mluis 0:cb80564f40e1 45 obj->value = 0;
mluis 0:cb80564f40e1 46 obj->Callback = callback;
mluis 0:cb80564f40e1 47 }
mluis 0:cb80564f40e1 48
mluis 0:cb80564f40e1 49 void TimerStart( TimerEvent_t *obj )
mluis 0:cb80564f40e1 50 {
mluis 0:cb80564f40e1 51 obj->Timer.attach_us( obj->Callback, obj->value );
mluis 0:cb80564f40e1 52 }
mluis 0:cb80564f40e1 53
mluis 0:cb80564f40e1 54 void TimerStop( TimerEvent_t *obj )
mluis 0:cb80564f40e1 55 {
mluis 0:cb80564f40e1 56 obj->Timer.detach( );
mluis 0:cb80564f40e1 57 }
mluis 0:cb80564f40e1 58
mluis 0:cb80564f40e1 59 void TimerSetValue( TimerEvent_t *obj, uint32_t value )
mluis 0:cb80564f40e1 60 {
mluis 0:cb80564f40e1 61 obj->value = value;
mluis 0:cb80564f40e1 62 }