Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed BMP085 BufferedSerial DHT Sds021 Chainable_RGB_LED DigitDisplay LoRaWAN-lib SX1272Lib
Fork of LoRaWAN-demo-72-bootcamp by
Revision 5:fa113b25f612, committed 2016-05-13
- Comitter:
- mluis
- Date:
- Fri May 13 15:51:40 2016 +0000
- Parent:
- 4:de084e23d884
- Child:
- 6:11b53eada5f3
- Commit message:
- Updated mbed, LoRaWAN-lib and SX1272Lib libraries.
Changed in this revision
--- a/app/Comissioning.h Mon Mar 14 09:19:11 2016 +0000
+++ b/app/Comissioning.h Fri May 13 15:51:40 2016 +0000
@@ -29,9 +29,14 @@
#if( OVER_THE_AIR_ACTIVATION != 0 )
/*!
+ * IEEE Organizationally Unique Identifier ( OUI ) (big endian)
+ */
+#define IEEE_OUI 0x11, 0x22, 0x33
+
+/*!
* Mote device IEEE EUI (big endian)
*/
-#define LORAWAN_DEVICE_EUI { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }
+#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x44, 0x55, 0x66, 0x77, 0x88 }
/*!
* Application IEEE EUI (big endian)
--- a/app/main.cpp Mon Mar 14 09:19:11 2016 +0000
+++ b/app/main.cpp Fri May 13 15:51:40 2016 +0000
@@ -24,7 +24,7 @@
/*!
* Join requests trials duty cycle.
*/
-#define OVER_THE_AIR_ACTIVATION_DUTYCYCLE 10000000 // 10 [s] value in us
+#define OVER_THE_AIR_ACTIVATION_DUTYCYCLE 10000000 // 10 [s] value in us
/*!
* Defines the application data transmission duty cycle. 5s, value in [us].
@@ -38,7 +38,7 @@
#define APP_TX_DUTYCYCLE_RND 1000000
/*!
- * Default mote datarate
+ * Default datarate
*/
#define LORAWAN_DEFAULT_DATARATE DR_5
@@ -65,6 +65,20 @@
*/
#define LORAWAN_DUTYCYCLE_ON false
+#define USE_SEMTECH_DEFAULT_CHANNEL_LINEUP 1
+
+#if( USE_SEMTECH_DEFAULT_CHANNEL_LINEUP == 1 )
+
+#define LC4 { 867100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
+#define LC5 { 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
+#define LC6 { 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
+#define LC7 { 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
+#define LC8 { 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 }
+#define LC9 { 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 }
+#define LC10 { 868300000, { ( ( DR_6 << 4 ) | DR_6 ) }, 1 }
+
+#endif
+
#endif
/*!
@@ -169,24 +183,24 @@
* 0: automatic (LED goes brigther as the light decrease,
* 1: manual (The LED is controlled by the user)
*/
-static uint8_t LightMode = 0; // 0:automatic, 1:manual
+static uint8_t LightMode = 0; // 0: automatic, 1: manual
/*!
* Ticker to create a PWM for the buzzer
*/
-Ticker BuzTimer;
+Ticker BuzzerTimer;
/*!
* Constructor for Buzzer
*/
-DigitalOut buzzer(A3);
+DigitalOut Buzzer( A3 );
/*!
* Constructor for the 3-color LED
*/
#define NUM_LED 3
-ChainableLED color_led(D6, D7, NUM_LED);
+ChainableLED ColorLed( D6, D7, NUM_LED );
/*!
* Constructor for Light Sensor
@@ -196,7 +210,7 @@
/*!
* Constructor for 4 Digit 7 semgent display
*/
-DigitDisplay display(D8, D9);
+DigitDisplay Display( D8, D9 );
/*!
* Device states
@@ -320,18 +334,16 @@
*/
static void PrepareTxFrame( uint8_t port )
{
- uint32_t tempValue;
-
switch( port )
{
case 10:
{
- tempValue = ( uint32_t )( LightValue * 1000000.0 );
+ uint32_t tempValue = ( uint32_t )( LightValue * 1000000.0 );
AppData[0] = LightMode;
AppData[1] = ( ( tempValue & 0xFF000000 ) >> 24 ) & 0xFF;
AppData[2] = ( ( tempValue & 0x00FF0000 ) >> 16 ) & 0xFF;
AppData[3] = ( ( tempValue & 0x0000FF00 ) >> 8 ) & 0xFF;
- AppData[4] = ( tempValue & 0x000000FF );
+ AppData[4] = ( tempValue & 0x000000FF );
}
break;
case 15:
@@ -394,7 +406,7 @@
mcpsReq.Req.Unconfirmed.fBuffer = NULL;
mcpsReq.Req.Unconfirmed.fBufferSize = 0;
mcpsReq.Req.Unconfirmed.Datarate = LORAWAN_DEFAULT_DATARATE;
-
+
LoRaMacUplinkStatus.Acked = false;
LoRaMacUplinkStatus.Port = 0;
LoRaMacUplinkStatus.Buffer = NULL;
@@ -487,23 +499,23 @@
/*!
* \brief Function executed on Buzzer Timeout event
*/
-static void OnBuzTimerEvent( void )
+static void OnBuzzerTimerEvent( void )
{
- buzzer = 0;
- BuzTimer.detach( );
+ Buzzer = 0;
+ BuzzerTimer.detach( );
}
/*!
* \brief MCPS-Confirm event function
*
- * \param [IN] McpsConfirm - Pointer to the confirm structure,
+ * \param [IN] mcpsConfirm - Pointer to the confirm structure,
* containing confirm attributes.
*/
-static void McpsConfirm( McpsConfirm_t *McpsConfirm )
+static void McpsConfirm( McpsConfirm_t *mcpsConfirm )
{
- if( McpsConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK )
+ if( mcpsConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK )
{
- switch( McpsConfirm->McpsRequest )
+ switch( mcpsConfirm->McpsRequest )
{
case MCPS_UNCONFIRMED:
{
@@ -516,8 +528,8 @@
// Check Datarate
// Check TxPower
// Check AckReceived
- // Check NbRetries
- LoRaMacUplinkStatus.Acked = McpsConfirm->AckReceived;
+ // Check NbTrials
+ LoRaMacUplinkStatus.Acked = mcpsConfirm->AckReceived;
break;
}
case MCPS_PROPRIETARY:
@@ -527,9 +539,9 @@
default:
break;
}
- LoRaMacUplinkStatus.Datarate = McpsConfirm->Datarate;
- LoRaMacUplinkStatus.UplinkCounter = McpsConfirm->UpLinkCounter;
-
+ LoRaMacUplinkStatus.Datarate = mcpsConfirm->Datarate;
+ LoRaMacUplinkStatus.UplinkCounter = mcpsConfirm->UpLinkCounter;
+
UplinkStatusUpdated = true;
}
NextTx = true;
@@ -538,17 +550,17 @@
/*!
* \brief MCPS-Indication event function
*
- * \param [IN] McpsIndication - Pointer to the indication structure,
+ * \param [IN] mcpsIndication - Pointer to the indication structure,
* containing indication attributes.
*/
-static void McpsIndication( McpsIndication_t *McpsIndication )
+static void McpsIndication( McpsIndication_t *mcpsIndication )
{
- if( McpsIndication->Status != LORAMAC_EVENT_INFO_STATUS_OK )
+ if( mcpsIndication->Status != LORAMAC_EVENT_INFO_STATUS_OK )
{
return;
}
- switch( McpsIndication->McpsIndication )
+ switch( mcpsIndication->McpsIndication )
{
case MCPS_UNCONFIRMED:
{
@@ -579,71 +591,67 @@
// Check Rssi
// Check Snr
// Check RxSlot
- LoRaMacDownlinkStatus.Rssi = McpsIndication->Rssi;
- if( McpsIndication->Snr & 0x80 ) // The SNR sign bit is 1
+ LoRaMacDownlinkStatus.Rssi = mcpsIndication->Rssi;
+ if( mcpsIndication->Snr & 0x80 ) // The SNR sign bit is 1
{
// Invert and divide by 4
- LoRaMacDownlinkStatus.Snr = ( ( ~McpsIndication->Snr + 1 ) & 0xFF ) >> 2;
+ LoRaMacDownlinkStatus.Snr = ( ( ~mcpsIndication->Snr + 1 ) & 0xFF ) >> 2;
LoRaMacDownlinkStatus.Snr = -LoRaMacDownlinkStatus.Snr;
}
else
{
// Divide by 4
- LoRaMacDownlinkStatus.Snr = ( McpsIndication->Snr & 0xFF ) >> 2;
+ LoRaMacDownlinkStatus.Snr = ( mcpsIndication->Snr & 0xFF ) >> 2;
}
LoRaMacDownlinkStatus.DownlinkCounter++;
- LoRaMacDownlinkStatus.RxData = McpsIndication->RxData;
- LoRaMacDownlinkStatus.Port = McpsIndication->Port;
- LoRaMacDownlinkStatus.Buffer = McpsIndication->Buffer;
- LoRaMacDownlinkStatus.BufferSize = McpsIndication->BufferSize;
+ LoRaMacDownlinkStatus.RxData = mcpsIndication->RxData;
+ LoRaMacDownlinkStatus.Port = mcpsIndication->Port;
+ LoRaMacDownlinkStatus.Buffer = mcpsIndication->Buffer;
+ LoRaMacDownlinkStatus.BufferSize = mcpsIndication->BufferSize;
if( ComplianceTest.Running == true )
{
ComplianceTest.DownLinkCounter++;
}
- if( McpsIndication->RxData == true )
+ if( mcpsIndication->RxData == true )
{
- switch( McpsIndication->Port )
+ switch( mcpsIndication->Port )
{
case 1: // The application LED can be controlled on port 1 or 2
case 2:
- if( McpsIndication->BufferSize == 1 )
+ if( mcpsIndication->BufferSize == 1 )
{
- AppLedStateOn = McpsIndication->Buffer[0] & 0x01;
+ AppLedStateOn = mcpsIndication->Buffer[0] & 0x01;
Led3StateChanged = true;
}
break;
-
case 10:
- display.write( 0, McpsIndication->Buffer[0] );
- display.write( 1, McpsIndication->Buffer[1] );
- display.write( 2, McpsIndication->Buffer[2] );
- display.write( 3, McpsIndication->Buffer[3] );
+ Display.write( 0, mcpsIndication->Buffer[0] );
+ Display.write( 1, mcpsIndication->Buffer[1] );
+ Display.write( 2, mcpsIndication->Buffer[2] );
+ Display.write( 3, mcpsIndication->Buffer[3] );
break;
-
case 20:
- LightMode = McpsIndication->Buffer[0];
+ LightMode = mcpsIndication->Buffer[0];
if( LightMode )
{
- color_led.setColorRGB(0, McpsIndication->Buffer[1], McpsIndication->Buffer[2], McpsIndication->Buffer[3] );
+ ColorLed.setColorRGB( 0, mcpsIndication->Buffer[1], mcpsIndication->Buffer[2], mcpsIndication->Buffer[3] );
}
break;
-
case 30:
- BuzTimer.attach_us( &OnBuzTimerEvent, 200000 );
- buzzer = 1;
+ BuzzerTimer.attach_us( &OnBuzzerTimerEvent, 200000 );
+ Buzzer = 1;
break;
-
case 224:
if( ComplianceTest.Running == false )
{
// Check compliance test enable command (i)
- if( ( McpsIndication->BufferSize == 4 ) &&
- ( McpsIndication->Buffer[0] == 0x01 ) &&
- ( McpsIndication->Buffer[1] == 0x01 ) &&
- ( McpsIndication->Buffer[2] == 0x01 ) &&
- ( McpsIndication->Buffer[3] == 0x01 ) )
+ if( ( mcpsIndication->BufferSize == 4 ) &&
+ ( mcpsIndication->Buffer[0] == 0x01 ) &&
+ ( mcpsIndication->Buffer[1] == 0x01 ) &&
+ ( mcpsIndication->Buffer[2] == 0x01 ) &&
+ ( mcpsIndication->Buffer[3] == 0x01 ) )
{
IsTxConfirmed = false;
AppPort = 224;
@@ -667,7 +675,7 @@
}
else
{
- ComplianceTest.State = McpsIndication->Buffer[0];
+ ComplianceTest.State = mcpsIndication->Buffer[0];
switch( ComplianceTest.State )
{
case 0: // Check compliance test disable command (ii)
@@ -697,12 +705,12 @@
ComplianceTest.State = 1;
break;
case 4: // (vii)
- AppDataSize = McpsIndication->BufferSize;
+ AppDataSize = mcpsIndication->BufferSize;
AppData[0] = 4;
for( uint8_t i = 1; i < AppDataSize; i++ )
{
- AppData[i] = McpsIndication->Buffer[i] + 1;
+ AppData[i] = mcpsIndication->Buffer[i] + 1;
}
break;
case 5: // (viii)
@@ -732,14 +740,14 @@
/*!
* \brief MLME-Confirm event function
*
- * \param [IN] MlmeConfirm - Pointer to the confirm structure,
+ * \param [IN] mlmeConfirm - Pointer to the confirm structure,
* containing confirm attributes.
*/
-static void MlmeConfirm( MlmeConfirm_t *MlmeConfirm )
+static void MlmeConfirm( MlmeConfirm_t *mlmeConfirm )
{
- if( MlmeConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK )
+ if( mlmeConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK )
{
- switch( MlmeConfirm->MlmeRequest )
+ switch( mlmeConfirm->MlmeRequest )
{
case MLME_JOIN:
{
@@ -754,8 +762,8 @@
if( ComplianceTest.Running == true )
{
ComplianceTest.LinkCheck = true;
- ComplianceTest.DemodMargin = MlmeConfirm->DemodMargin;
- ComplianceTest.NbGateways = MlmeConfirm->NbGateways;
+ ComplianceTest.DemodMargin = mlmeConfirm->DemodMargin;
+ ComplianceTest.NbGateways = mlmeConfirm->NbGateways;
}
break;
}
@@ -772,11 +780,6 @@
*/
int main( void )
{
- float tempLightValue = 0.0;
-
- LightMode = 0; // 0: manual, 1: automatic
- buzzer = 0; // 0: OFF, 1: ON
-
LoRaMacPrimitives_t LoRaMacPrimitives;
LoRaMacCallback_t LoRaMacCallbacks;
MibRequestConfirm_t mibReq;
@@ -784,6 +787,9 @@
BoardInit( );
SerialDisplayInit( );
+ LightMode = 0; // 0: manual, 1: automatic
+ Buzzer = 0; // 0: OFF, 1: ON
+
DeviceState = DEVICE_STATE_INIT;
while( 1 )
@@ -852,6 +858,17 @@
#if defined( USE_BAND_868 )
LoRaMacTestSetDutyCycleOn( LORAWAN_DUTYCYCLE_ON );
SerialDisplayUpdateDutyCycle( LORAWAN_DUTYCYCLE_ON );
+
+#if( USE_SEMTECH_DEFAULT_CHANNEL_LINEUP == 1 )
+ LoRaMacChannelAdd( 3, ( ChannelParams_t )LC4 );
+ LoRaMacChannelAdd( 4, ( ChannelParams_t )LC5 );
+ LoRaMacChannelAdd( 5, ( ChannelParams_t )LC6 );
+ LoRaMacChannelAdd( 6, ( ChannelParams_t )LC7 );
+ LoRaMacChannelAdd( 7, ( ChannelParams_t )LC8 );
+ LoRaMacChannelAdd( 8, ( ChannelParams_t )LC9 );
+ LoRaMacChannelAdd( 9, ( ChannelParams_t )LC10 );
+#endif
+
#endif
SerialDisplayUpdateActivationMode( OVER_THE_AIR_ACTIVATION );
SerialDisplayUpdateAdr( LORAWAN_ADR_ON );
@@ -934,8 +951,8 @@
}
if( ComplianceTest.Running == true )
{
- // Schedule next packet transmission as soon as possible
- TxDutyCycleTime = 1000; // 1 ms
+ // Schedule next packet transmission
+ TxDutyCycleTime = 5000000; // 5000000 us
}
else
{
@@ -947,11 +964,11 @@
}
case DEVICE_STATE_CYCLE:
{
+ DeviceState = DEVICE_STATE_SLEEP;
+
// Schedule next packet transmission
TimerSetValue( &TxNextPacketTimer, TxDutyCycleTime );
TimerStart( &TxNextPacketTimer );
-
- DeviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
@@ -966,16 +983,14 @@
}
}
-
+
// Read light sensor
- tempLightValue = LightSens.read( ) * 1.65;
-
- LightValue = ( 1 - tempLightValue );
-
+ LightValue = ( 1 - ( LightSens.read( ) * 1.65 ) );
+
// Set automatic RGB from light sensor
if( LightMode == 0 )
{
- color_led.setColorRGB( 0, ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ) );
+ ColorLed.setColorRGB( 0, ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ) );
}
}
}
--- a/mac/LoRaWAN-lib.lib Mon Mar 14 09:19:11 2016 +0000 +++ b/mac/LoRaWAN-lib.lib Fri May 13 15:51:40 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#b9d87593a8ae +http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#37c12dbc8dc7
--- a/mbed.bld Mon Mar 14 09:19:11 2016 +0000 +++ b/mbed.bld Fri May 13 15:51:40 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/7c328cabac7e \ No newline at end of file
--- a/radio/SX1272Lib.lib Mon Mar 14 09:19:11 2016 +0000 +++ b/radio/SX1272Lib.lib Fri May 13 15:51:40 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/SX1272Lib/#5baff45eb3c5 +http://developer.mbed.org/teams/Semtech/code/SX1272Lib/#90bd79f1b458
--- a/system/crypto/aes.cpp Mon Mar 14 09:19:11 2016 +0000
+++ b/system/crypto/aes.cpp Fri May 13 15:51:40 2016 +0000
@@ -46,7 +46,7 @@
#include <stdint.h>
/* define if you have fast 32-bit types on your system */
-#if 1
+#if ( __CORTEX_M != 0 ) // if Cortex is different from M0/M0+
# define HAVE_UINT_32T
#endif
@@ -239,7 +239,7 @@
static uint8_t gf_inv(const uint8_t x)
{ uint8_t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
- if(x < 2)
+ if(x < 2)
return x;
for( ; ; )
@@ -247,20 +247,20 @@
if(n1)
while(n2 >= n1) /* divide polynomial p2 by p1 */
{
- n2 /= n1; /* shift smaller polynomial left */
+ n2 /= n1; /* shift smaller polynomial left */
p2 ^= (p1 * n2) & 0xff; /* and remove from larger one */
- v2 ^= (v1 * n2); /* shift accumulated value and */
+ v2 ^= (v1 * n2); /* shift accumulated value and */
n2 = hibit(p2); /* add into result */
}
else
return v1;
- if(n2) /* repeat with values swapped */
+ if(n2) /* repeat with values swapped */
while(n1 >= n2)
{
- n1 /= n2;
- p1 ^= p2 * n1;
- v1 ^= v2 * n1;
+ n1 /= n2;
+ p1 ^= p2 * n1;
+ v1 ^= v2 * n1;
n1 = hibit(p1);
}
else
@@ -270,13 +270,13 @@
/* The forward and inverse affine transformations used in the S-box */
uint8_t fwd_affine(const uint8_t x)
-{
+{
#if defined( HAVE_UINT_32T )
uint32_t w = x;
w ^= (w << 1) ^ (w << 2) ^ (w << 3) ^ (w << 4);
return 0x63 ^ ((w ^ (w >> 8)) & 0xff);
#else
- return 0x63 ^ x ^ (x << 1) ^ (x << 2) ^ (x << 3) ^ (x << 4)
+ return 0x63 ^ x ^ (x << 1) ^ (x << 2) ^ (x << 3) ^ (x << 4)
^ (x >> 7) ^ (x >> 6) ^ (x >> 5) ^ (x >> 4);
#endif
}
@@ -288,7 +288,7 @@
w = (w << 1) ^ (w << 3) ^ (w << 6);
return 0x05 ^ ((w ^ (w >> 8)) & 0xff);
#else
- return 0x05 ^ (x << 1) ^ (x << 3) ^ (x << 6)
+ return 0x05 ^ (x << 1) ^ (x << 3) ^ (x << 6)
^ (x >> 7) ^ (x >> 5) ^ (x >> 2);
#endif
}
@@ -520,8 +520,8 @@
case 24:
case 32:
break;
- default:
- ctx->rnd = 0;
+ default:
+ ctx->rnd = 0;
return ( uint8_t )-1;
}
block_copy_nn(ctx->ksch, key, keylen);
@@ -648,10 +648,10 @@
return_type aes_cbc_decrypt( const uint8_t *in, uint8_t *out,
int32_t n_block, uint8_t iv[N_BLOCK], const aes_context ctx[1] )
-{
+{
while(n_block--)
{ uint8_t tmp[N_BLOCK];
-
+
//memcpy(tmp, in, N_BLOCK);
block_copy(tmp, in);
if(aes_decrypt(in, out, ctx) != EXIT_SUCCESS)
--- a/system/crypto/cmac.cpp Mon Mar 14 09:19:11 2016 +0000
+++ b/system/crypto/cmac.cpp Fri May 13 15:51:40 2016 +0000
@@ -86,7 +86,7 @@
len -= mlen;
}
while (len > 16) { /* not last block */
-
+
XOR(data, ctx->X);
//rijndael_encrypt(&ctx->rijndael, ctx->X, ctx->X);
@@ -119,7 +119,7 @@
} else
LSHIFT(K, K);
-
+
if (ctx->M_n == 16) {
/* last block was a complete block */
XOR(K, ctx->M_last);
@@ -138,13 +138,13 @@
ctx->M_last[ctx->M_n] = 0;
XOR(K, ctx->M_last);
-
-
+
+
}
XOR(ctx->M_last, ctx->X);
-
+
//rijndael_encrypt(&ctx->rijndael, ctx->X, digest);
-
+
memcpy1(in, &ctx->X[0], 16); //Bestela ez du ondo iten
aes_encrypt(in, digest, &ctx->rijndael);
memset1(K, 0, sizeof K);
--- a/system/timer.cpp Mon Mar 14 09:19:11 2016 +0000
+++ b/system/timer.cpp Fri May 13 15:51:40 2016 +0000
@@ -40,6 +40,22 @@
return ( ( TimerTime_t )CurrentTime );
}
+TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime )
+{
+ CurrentTime += TimeCounter.read_us( );
+ TimeCounter.reset( );
+ TimeCounter.start( );
+ return ( TimerTime_t )( CurrentTime - savedTime );
+}
+
+TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture )
+{
+ CurrentTime += TimeCounter.read_us( );
+ TimeCounter.reset( );
+ TimeCounter.start( );
+ return ( TimerTime_t )( CurrentTime + eventInFuture );
+}
+
void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) )
{
obj->value = 0;
--- a/system/timer.h Mon Mar 14 09:19:11 2016 +0000 +++ b/system/timer.h Fri May 13 15:51:40 2016 +0000 @@ -88,5 +88,20 @@ */ TimerTime_t TimerGetCurrentTime( void ); +/*! + * \brief Return the Time elapsed since a fix moment in Time + * + * \param [IN] savedTime fix moment in Time + * \retval time returns elapsed time + */ +TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime ); + +/*! + * \brief Return the Time elapsed since a fix moment in Time + * + * \param [IN] eventInFuture fix moment in the future + * \retval time returns difference between now and future event + */ +TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture ); #endif // __TIMER_H__
