Long Range / Mbed 2 deprecated SX1272_LoRaWAN_App_LR

Dependencies:   X_NUCLEO_IKS01A2 driver_mbed_TH02 mbed LoRaWAN-lib-v1_0_1 SX1272Lib

Fork of Training-Aug2018-SX1272-X-NUCLEO-IKS01A2 by Uttam Bhat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaApp.h Source File

LoRaApp.h

00001 /*
00002  / _____)             _              | |
00003 ( (____  _____ ____ _| |_ _____  ____| |__
00004  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00005  _____) ) ____| | | || |_| ____( (___| | | |
00006 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00007     (C)2015 Semtech
00008 
00009 Description: User-defined applications such as GPS, Temp, Accelerometer, LED indications etc.
00010             Event based actions such as LED blink on Tx, LED toggle on downlink etc
00011 
00012 License: Revised BSD License, see LICENSE.TXT file include in the project
00013 
00014 Maintainer: Uttam Bhat
00015 */
00016 
00017 #ifndef __APPLICATION_H__
00018 #define __APPLICATION_H__
00019 
00020 #include "board.h"
00021 #include "Common.h"
00022 #include "SerialDisplay.h"
00023 
00024 /*!
00025  * LED ON/OFF definition
00026  */
00027 #define LED_ON          0
00028 #define LED_OFF         1
00029 
00030 /*!
00031  * LED types
00032  */
00033 enum eLedType
00034 {
00035     Red = 0,// Red LED
00036     Yellow = 1, // Yellow LED
00037     Green = 2, // Green LED
00038     Usr = 3, // USR LED
00039 };
00040 
00041 /*!
00042  * user-defined Application names
00043  */
00044 enum eAppType
00045 {
00046     AppPressr = 0, // Pressure measurement application
00047     AppTemp, // Temperature measurement application
00048     AppHumid, // Humidity measurement application
00049     AppBat, // Battery measurement application
00050     AppRamp, // Generate Ramp bytes
00051     AppAccl, // Accelerometer application    
00052     AppGyro, // Gyrometer application
00053     AppPushButton, // Push button application example
00054 };
00055 
00056 /*!
00057  * Application
00058  */
00059 class Application  
00060 {
00061 public:
00062     /*!  
00063      * \brief Initializes TX buffer address to private pointer
00064      *
00065      * \param [IN] memptr pointer to TX buffer
00066      */
00067     Application( uint8_t * memptr );
00068 
00069     /*!
00070      * \brief Application Destructor
00071      */
00072     ~Application( );
00073     
00074      /*!     
00075      * \brief Call application type and append to application buffer
00076      *
00077      * \param [IN] AppType application type: GPS, Battery, Temp etc.
00078      */
00079     void ApplicationCall( eAppType AppType );
00080      
00081      /*!     
00082      * \brief Append data to the TX buffer
00083      *
00084      * \param [IN] pData pointer to the data to be appended to TX buffer
00085      * \param [IN] Len lenght of the data to be appended to TX buffer
00086      */
00087     void ApplicationAppendData( uint8_t *pData, uint8_t len );
00088     
00089      /*!     
00090      * \brief Point the pointer corresponding to the TX buffer to specified index
00091      *
00092      * \param [IN] ptrPos index to where to point to in the TX buffer
00093      */
00094     void ApplicationPtrPos( uint8_t ptrPos );
00095 
00096 private:
00097     /*!
00098      * Index to the application buffer
00099      */
00100     uint8_t BuffPtr;
00101     /*!
00102      * Application buffer address pointer
00103      */
00104     uint8_t *BuffAddr;   
00105 };
00106 
00107 class TimerLed
00108 {
00109 public:
00110     TimerEvent_t LedTimer;      
00111     TimerLed( eLedType );
00112     ~TimerLed( );
00113 };
00114 
00115 extern TimerLed RedLedTimer;
00116 
00117 extern TimerLed YellowLedTimer;
00118 
00119 extern TimerLed GreenLedTimer;
00120 
00121 extern Application  LoRaApp;
00122 
00123 extern bool AppLed;
00124 
00125 extern bool VerticalStatus;
00126 
00127 #ifdef USE_CAYENNE_LPP
00128 extern uint8_t maxLPPsize[5];
00129 #endif
00130 
00131 /*!  
00132 * \brief Blink LED
00133 *
00134 * \param [IN] led Red, yellow or green LED
00135 * \param [IN] time time in usec for which the LED must be ON
00136  */
00137 void BlinkLED( eLedType led, uint32_t time );
00138 
00139 /*!  
00140 * \brief Turn LED ON if OFF; OFF if ON
00141 *
00142 * \param [IN] led Red, yellow or green LED
00143 */
00144 void ToggleLED( eLedType led );
00145 
00146 /*!  
00147 * \brief Control the State of the LED
00148 *
00149 * \param [IN] led Red, yellow or green LED
00150 * \param [IN] state ON or OFF
00151 */
00152 void CtrlLED( eLedType led, uint8_t state );
00153 
00154 void CheckOrientation( void );
00155 
00156 #endif // __APPLICATION_H__