Long Range / Mbed 2 deprecated SX1272_LoRaWAN_App_LR

Dependencies:   X_NUCLEO_IKS01A2 driver_mbed_TH02 mbed LoRaWAN-lib-v1_0_1 SX1272Lib

Fork of Training-Aug2018-SX1272-X-NUCLEO-IKS01A2 by Uttam Bhat

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 "system/utilities.h"
00022 #include "sx1272-hal.h"
00023 #include "XNucleoIKS01A2.h"
00024 
00025 #ifdef USE_GROVE_SENSOR
00026 // Grove temperature-humidity sensor
00027 #include "driver_mbed_TH02.h"
00028 #endif
00029 
00030 #if defined ( TARGET_NUCLEO_L152RE )
00031 /*!
00032  * Unique Devices IDs register set ( STM32L1xxx )
00033  */
00034 #define         ID1                                 ( 0x1FF800D0 )
00035 #define         ID2                                 ( 0x1FF800D4 )
00036 #define         ID3                                 ( 0x1FF800E4 )
00037 
00038 #elif defined ( TARGET_NUCLEO_F401RE )
00039 /*!
00040  * Unique Devices IDs register set ( STM32F4xxx )
00041  */
00042 #define         ID1                                 ( 0x1FFF7A10 )
00043 #define         ID2                                 ( 0x1FFF7A14 )
00044 #define         ID3                                 ( 0x1FFF7A18 )
00045 
00046 #elif defined ( TARGET_NUCLEO_L073RZ )
00047 /*!
00048  * Unique Devices IDs register set ( STM32L0xxx )
00049  */
00050 #define         ID1                                 ( 0x1FF80050 )
00051 #define         ID2                                 ( 0x1FF80054 )
00052 #define         ID3                                 ( 0x1FF80064 )
00053 
00054 #endif
00055 
00056 #define LOW_BAT_THRESHOLD   3.45
00057 #define AIN_VREF            3.3     // STM32 internal refernce
00058 #define AIN_VBAT_DIV        2       // Resistor divider
00059 
00060 extern SX1272MB2xAS Radio;
00061 
00062 extern DigitalIn UsrButton;
00063 
00064 extern DigitalOut Led;
00065 
00066 /* Instantiate the expansion board */
00067 extern XNucleoIKS01A2 *mems_expansion_board;
00068  
00069 /* Retrieve the composing elements of the expansion board */
00070 extern LSM303AGRMagSensor *magnetometer;
00071 extern HTS221Sensor *hum_temp;
00072 extern LPS22HBSensor *press_temp;
00073 extern LSM6DSLSensor *acc_gyro;
00074 extern LSM303AGRAccSensor *accelerometer;
00075 
00076 /*!
00077  * \brief Initializes the target board peripherals.
00078  */
00079 void BoardInit( void );
00080 
00081 /*!
00082  * \brief Measure the Battery level
00083  *
00084  * \retval value  battery level ( 0: very low, 254: fully charged )
00085  */
00086 uint8_t BoardGetBatteryLevel( void );
00087 
00088 /*!
00089  * Returns a pseudo random seed generated using the MCU Unique ID
00090  *
00091  * \retval seed Generated pseudo random seed
00092  */
00093 uint32_t BoardGetRandomSeed( void );
00094 
00095 /*!
00096  * \brief Generates Lower 32 bits of DEVEUI using 96 bits unique device ID 
00097  *
00098  * \param [IN] id Pointer to an array that will contain the Unique ID
00099  */
00100 void BoardGetDevEUI( uint8_t *id );
00101 
00102 /*!
00103  * \brief Gets the board 64 bits unique ID 
00104  *
00105  * \param [IN] id Pointer to an array that will contain the Unique ID
00106  */
00107 void BoardGetUniqueId( uint8_t *id );
00108 
00109 #endif // __BOARD_H__