Semtech / LoRaWAN-NAMote72-Application-Demo

Dependencies:   LoRaWAN-lib mbed lib_mpl3115a2 lib_mma8451q lib_gps SX1272Lib

Dependents:   LoRaWAN-NAMote72-BVS-confirmed-tester-0-7v1_copy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers board.h Source File

board.h

00001 /*
00002  / _____)             _              | |
00003 ( (____  _____ ____ _| |_ _____  ____| |__
00004  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00005  _____) ) ____| | | || |_| ____( (___| | | |
00006 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00007     (C)2015 Semtech
00008 
00009 Description: Target board general functions implementation
00010 
00011 License: Revised BSD License, see LICENSE.TXT file include in the project
00012 
00013 Maintainer: Miguel Luis and Gregory Cristian
00014 */
00015 #ifndef __BOARD_H__
00016 #define __BOARD_H__
00017 
00018 #include "Config.h"
00019 #include "mbed.h"
00020 #include "system/timer.h"
00021 //#include "debug.h"
00022 #include "system/utilities.h"
00023 #include "sx1272-hal.h"
00024 #include "gps.h"
00025 #include "mpl3115a2.h"
00026 #include "mma8451q.h"
00027 
00028 #define LOW_BAT_THRESHOLD   3450 // mV
00029 
00030 extern DigitalOut RedLed;
00031 extern DigitalOut GreenLed;
00032 extern DigitalOut YellowLed;
00033 extern DigitalOut UsrLed;
00034 extern GPS Gps;
00035 extern MPL3115A2 Mpl3115a2;
00036 extern MMA8451Q Mma8451q;
00037 
00038 extern DigitalIn PC0; // Used for Push button application demo
00039 
00040 extern SX1272MB2xAS Radio;
00041 
00042 /*!
00043  * Board versions
00044  */
00045 typedef enum
00046 {
00047     BOARD_VERSION_NONE = 0,
00048     BOARD_VERSION_2,
00049     BOARD_VERSION_3,
00050 }BoardVersion_t;
00051 
00052 /*!
00053  * \brief Disable interrupts
00054  *
00055  * \remark IRQ nesting is managed
00056  */
00057 void BoardDisableIrq( void );
00058 
00059 /*!
00060  * \brief Enable interrupts
00061  *
00062  * \remark IRQ nesting is managed
00063  */
00064 void BoardEnableIrq( void );
00065 
00066 /*!
00067  * \brief Initializes the target board peripherals.
00068  */
00069 void BoardInit( void );
00070 
00071 /*!
00072  * \brief Measure the Battery voltage
00073  *
00074  * \retval value  battery voltage in millivolts
00075  */
00076 uint32_t BoardGetBatteryVoltage( void );
00077 
00078 /*!
00079  * \brief Get the current battery level
00080  *
00081  * \retval value  battery level [  0: USB,
00082  *                                 1: Min level,
00083  *                                 x: level
00084  *                               254: fully charged,
00085  *                               255: Error]
00086  */
00087 uint8_t BoardGetBatteryLevel( void );
00088 
00089 /*!
00090  * Returns a pseudo random seed generated using the MCU Unique ID
00091  *
00092  * \retval seed Generated pseudo random seed
00093  */
00094 uint32_t BoardGetRandomSeed( void );
00095 
00096 /*!
00097  * \brief Gets the board 64 bits unique ID
00098  *
00099  * \param [IN] id Pointer to an array that will contain the Unique ID
00100  */
00101 void BoardGetUniqueId( uint8_t *id );
00102 
00103 /*!
00104  * \brief Get the board version
00105  *
00106  * \retval value  Version [0: MOTE_VERSION_NONE, 
00107  *                         1: MOTE_VERSION_2,
00108  *                         2: MOTE_VERSION_3]
00109  */
00110 BoardVersion_t BoardGetVersion( void );
00111 
00112 /*!
00113  * \brief Generates Lower 32 bits of DEVEUI using 96 bits unique device ID 
00114  *
00115  * \param [IN] id Pointer to an array that will contain the Unique ID
00116  */
00117 void BoardGetDevEUI( uint8_t *id );
00118 
00119 #endif // __BOARD_H__