Nagaraj Krishnamurthy / LoRaWAN-NAMote72-Application-Demo_IoTium

Dependencies:   LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed

Fork of LoRaWAN-NAMote72-Application-Demo_Multitech by Nagaraj Krishnamurthy

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 /*!
00029  * Unique Devices IDs register set ( STM32L1xxx )
00030  */
00031 #define         ID1                                 ( 0x1FF800D0 )
00032 #define         ID2                                 ( 0x1FF800D4 )
00033 #define         ID3                                 ( 0x1FF800E4 )
00034 
00035 #define LOW_BAT_THRESHOLD   3.45
00036 
00037 extern DigitalOut RedLed;
00038 extern DigitalOut GreenLed;
00039 extern DigitalOut YellowLed;
00040 extern DigitalOut UsrLed;
00041 extern GPS Gps;
00042 extern MPL3115A2 Mpl3115a2;
00043 extern MMA8451Q Mma8451q;
00044 
00045 extern DigitalIn PC0; // Used for Push button application demo
00046 
00047 extern SX1272MB2xAS Radio;
00048 
00049 typedef enum
00050 {
00051     MOTE_VERSION_NONE = 0,
00052     MOTE_VERSION_2,
00053     MOTE_VERSION_3,
00054 }MoteVersion_t;
00055 
00056 
00057 /*!
00058  * \brief Initializes the target board peripherals.
00059  */
00060 void BoardInit( void );
00061 
00062 /*!
00063  * \brief Measure the Battery level
00064  *
00065  * \retval value  battery level ( 0: very low, 254: fully charged )
00066  */
00067 uint8_t BoardGetBatteryLevel( void );
00068 
00069 /*!
00070  * \brief Measure the Battery voltage
00071  *
00072  * \retval value  battery voltage in volts
00073  */
00074 float BoardGetBatteryVoltage( void );
00075 
00076 /*!
00077  * Returns a pseudo random seed generated using the MCU Unique ID
00078  *
00079  * \retval seed Generated pseudo random seed
00080  */
00081 uint32_t BoardGetRandomSeed( void );
00082 
00083 /*!
00084  * \brief Generates Lower 32 bits of DEVEUI using 96 bits unique device ID 
00085  *
00086  * \param [IN] id Pointer to an array that will contain the Unique ID
00087  */
00088 void BoardGetDevEUI( uint8_t *id );
00089 
00090 /*!
00091  * \brief Gets the board 64 bits unique ID 
00092  *
00093  * \param [IN] id Pointer to an array that will contain the Unique ID
00094  */
00095 void BoardGetUniqueId( uint8_t *id );
00096 
00097 #endif // __BOARD_H__