Test Fork

Dependencies:   LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed

Fork of LoRaWAN-NAMote72-Application-Demo by Semtech

Revision:
0:69f2e28d12c1
Child:
6:f8194e691dd4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/LoRaApp.h	Tue May 17 00:21:55 2016 +0000
@@ -0,0 +1,146 @@
+/*
+ / _____)             _              | |
+( (____  _____ ____ _| |_ _____  ____| |__
+ \____ \| ___ |    (_   _) ___ |/ ___)  _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+    (C)2015 Semtech
+
+Description: User-defined applications such as GPS, Temp, Accelerometer, LED indications etc.
+            Event based actions such as LED blink on Tx, LED toggle on downlink etc
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainer: Uttam Bhat
+*/
+
+#ifndef __APPLICATION_H__
+#define __APPLICATION_H__
+
+#include "board.h"
+#include "Common.h"
+#include "SerialDisplay.h"
+
+/*!
+ * LED ON/OFF definition
+ */
+#define LED_ON          0
+#define LED_OFF         1
+
+/*!
+ * LED types
+ */
+enum eLedType
+{
+    Red = 0,// Red LED
+    Yellow = 1, // Yellow LED
+    Green = 2, // Green LED
+    Usr = 3, // USR LED
+};
+
+/*!
+ * user-defined Application names
+ */
+enum eAppType
+{
+    AppGps = 0, // GPS application
+    AppTemp = 1, // Temperature measurement application
+    AppBat = 2, // Battery measurement application
+    AppRamp = 3, // Generate Ramp bytes
+    AppAccl = 4, // Accelerometer application
+    AppAcclSenet = 5, // Senet + M2X application example
+};
+
+/*!
+ * Application
+ */
+class Application 
+{
+public:
+    /*!  
+     * \brief Initializes TX buffer address to private pointer
+     *
+     * \param [IN] memptr pointer to TX buffer
+     */
+    Application( uint8_t * memptr );
+
+    /*!
+     * \brief Application Destructor
+     */
+    ~Application( );
+    
+     /*!     
+     * \brief Call application type and append to application buffer
+     *
+     * \param [IN] AppType application type: GPS, Battery, Temp etc.
+     */
+    void ApplicationCall( eAppType AppType );
+     
+     /*!     
+     * \brief Append data to the TX buffer
+     *
+     * \param [IN] pData pointer to the data to be appended to TX buffer
+     * \param [IN] Len lenght of the data to be appended to TX buffer
+     */
+    void ApplicationAppendData( uint8_t *pData, uint8_t len );
+    
+     /*!     
+     * \brief Point the pointer corresponding to the TX buffer to specified index
+     *
+     * \param [IN] ptrPos index to where to point to in the TX buffer
+     */
+    void ApplicationPtrPos( uint8_t ptrPos );
+
+private:
+    /*!
+     * Index to the application buffer
+     */
+    uint8_t BuffPtr;
+    /*!
+     * Application buffer address pointer
+     */
+    uint8_t *BuffAddr;   
+};
+
+class TimerLed
+{
+public:
+    TimerEvent_t LedTimer;      
+    TimerLed( eLedType );
+    ~TimerLed( );
+};
+
+extern TimerLed RedLedTimer;
+
+extern TimerLed YellowLedTimer;
+
+extern TimerLed GreenLedTimer;
+
+extern Application LoRaApp;
+
+extern bool AppLed;
+
+/*!  
+* \brief Blink LED
+*
+* \param [IN] led Red, yellow or green LED
+* \param [IN] time time in usec for which the LED must be ON
+ */
+void BlinkLED( eLedType led, uint32_t time );
+
+/*!  
+* \brief Turn LED ON if OFF; OFF if ON
+*
+* \param [IN] led Red, yellow or green LED
+*/
+void ToggleLED( eLedType led );
+
+/*!  
+* \brief Control the State of the LED
+*
+* \param [IN] led Red, yellow or green LED
+* \param [IN] state ON or OFF
+*/
+void CtrlLED( eLedType led, uint8_t state );
+
+#endif // __APPLICATION_H__
\ No newline at end of file