Test Fork
Dependencies: LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed
Fork of LoRaWAN-NAMote72-Application-Demo by
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 AppGps = 0, // GPS application 00047 AppTemp = 1, // Temperature measurement application 00048 AppBat = 2, // Battery measurement application 00049 AppRamp = 3, // Generate Ramp bytes 00050 AppAccl = 4, // Accelerometer application 00051 AppAcclSenet = 5, // Senet + M2X application example 00052 AppPushButton = 6, // Push button application example 00053 }; 00054 00055 /*! 00056 * Application 00057 */ 00058 class Application 00059 { 00060 public: 00061 /*! 00062 * \brief Initializes TX buffer address to private pointer 00063 * 00064 * \param [IN] memptr pointer to TX buffer 00065 */ 00066 Application( uint8_t * memptr ); 00067 00068 /*! 00069 * \brief Application Destructor 00070 */ 00071 ~Application( ); 00072 00073 /*! 00074 * \brief Call application type and append to application buffer 00075 * 00076 * \param [IN] AppType application type: GPS, Battery, Temp etc. 00077 */ 00078 void ApplicationCall( eAppType AppType ); 00079 00080 /*! 00081 * \brief Append data to the TX buffer 00082 * 00083 * \param [IN] pData pointer to the data to be appended to TX buffer 00084 * \param [IN] Len lenght of the data to be appended to TX buffer 00085 */ 00086 void ApplicationAppendData( uint8_t *pData, uint8_t len ); 00087 00088 /*! 00089 * \brief Point the pointer corresponding to the TX buffer to specified index 00090 * 00091 * \param [IN] ptrPos index to where to point to in the TX buffer 00092 */ 00093 void ApplicationPtrPos( uint8_t ptrPos ); 00094 00095 private: 00096 /*! 00097 * Index to the application buffer 00098 */ 00099 uint8_t BuffPtr; 00100 /*! 00101 * Application buffer address pointer 00102 */ 00103 uint8_t *BuffAddr; 00104 }; 00105 00106 class TimerLed 00107 { 00108 public: 00109 TimerEvent_t LedTimer; 00110 TimerLed( eLedType ); 00111 ~TimerLed( ); 00112 }; 00113 00114 extern TimerLed RedLedTimer; 00115 00116 extern TimerLed YellowLedTimer; 00117 00118 extern TimerLed GreenLedTimer; 00119 00120 extern Application LoRaApp; 00121 00122 extern bool AppLed; 00123 00124 extern bool VerticalStatus; 00125 00126 /*! 00127 * \brief Blink LED 00128 * 00129 * \param [IN] led Red, yellow or green LED 00130 * \param [IN] time time in usec for which the LED must be ON 00131 */ 00132 void BlinkLED( eLedType led, uint32_t time ); 00133 00134 /*! 00135 * \brief Turn LED ON if OFF; OFF if ON 00136 * 00137 * \param [IN] led Red, yellow or green LED 00138 */ 00139 void ToggleLED( eLedType led ); 00140 00141 /*! 00142 * \brief Control the State of the LED 00143 * 00144 * \param [IN] led Red, yellow or green LED 00145 * \param [IN] state ON or OFF 00146 */ 00147 void CtrlLED( eLedType led, uint8_t state ); 00148 00149 void CheckOrientation( void ); 00150 00151 #endif // __APPLICATION_H__
Generated on Mon Jul 25 2022 17:07:03 by
![doxygen](doxygen.png)