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