Test Fork
Dependencies: LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed
Fork of LoRaWAN-NAMote72-Application-Demo by
board/board.h@12:504203733f11, 2016-08-05 (annotated)
- Committer:
- ubhat
- Date:
- Fri Aug 05 20:45:12 2016 +0000
- Revision:
- 12:504203733f11
- Parent:
- 6:f8194e691dd4
Revert to Revision 9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ubhat | 0:69f2e28d12c1 | 1 | /* |
ubhat | 0:69f2e28d12c1 | 2 | / _____) _ | | |
ubhat | 0:69f2e28d12c1 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
ubhat | 0:69f2e28d12c1 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
ubhat | 0:69f2e28d12c1 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
ubhat | 0:69f2e28d12c1 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
ubhat | 0:69f2e28d12c1 | 7 | (C)2015 Semtech |
ubhat | 0:69f2e28d12c1 | 8 | |
ubhat | 0:69f2e28d12c1 | 9 | Description: Target board general functions implementation |
ubhat | 0:69f2e28d12c1 | 10 | |
ubhat | 0:69f2e28d12c1 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
ubhat | 0:69f2e28d12c1 | 12 | |
ubhat | 0:69f2e28d12c1 | 13 | Maintainer: Miguel Luis and Gregory Cristian |
ubhat | 0:69f2e28d12c1 | 14 | */ |
ubhat | 0:69f2e28d12c1 | 15 | #ifndef __BOARD_H__ |
ubhat | 0:69f2e28d12c1 | 16 | #define __BOARD_H__ |
ubhat | 0:69f2e28d12c1 | 17 | |
ubhat | 0:69f2e28d12c1 | 18 | #include "Config.h" |
ubhat | 0:69f2e28d12c1 | 19 | #include "mbed.h" |
ubhat | 0:69f2e28d12c1 | 20 | #include "system/timer.h" |
ubhat | 0:69f2e28d12c1 | 21 | #include "debug.h" |
ubhat | 0:69f2e28d12c1 | 22 | #include "system/utilities.h" |
ubhat | 0:69f2e28d12c1 | 23 | #include "sx1272-hal.h" |
ubhat | 0:69f2e28d12c1 | 24 | #include "gps.h" |
ubhat | 0:69f2e28d12c1 | 25 | #include "mpl3115a2.h" |
ubhat | 0:69f2e28d12c1 | 26 | #include "mma8451q.h" |
ubhat | 0:69f2e28d12c1 | 27 | |
ubhat | 0:69f2e28d12c1 | 28 | /*! |
ubhat | 0:69f2e28d12c1 | 29 | * Unique Devices IDs register set ( STM32L1xxx ) |
ubhat | 0:69f2e28d12c1 | 30 | */ |
ubhat | 0:69f2e28d12c1 | 31 | #define ID1 ( 0x1FF800D0 ) |
ubhat | 0:69f2e28d12c1 | 32 | #define ID2 ( 0x1FF800D4 ) |
ubhat | 0:69f2e28d12c1 | 33 | #define ID3 ( 0x1FF800E4 ) |
ubhat | 0:69f2e28d12c1 | 34 | |
ubhat | 0:69f2e28d12c1 | 35 | #define LOW_BAT_THRESHOLD 3.45 |
ubhat | 0:69f2e28d12c1 | 36 | |
ubhat | 0:69f2e28d12c1 | 37 | extern DigitalOut RedLed; |
ubhat | 0:69f2e28d12c1 | 38 | extern DigitalOut GreenLed; |
ubhat | 0:69f2e28d12c1 | 39 | extern DigitalOut YellowLed; |
ubhat | 0:69f2e28d12c1 | 40 | extern DigitalOut UsrLed; |
ubhat | 0:69f2e28d12c1 | 41 | extern GPS Gps; |
ubhat | 0:69f2e28d12c1 | 42 | extern MPL3115A2 Mpl3115a2; |
ubhat | 0:69f2e28d12c1 | 43 | extern MMA8451Q Mma8451q; |
ubhat | 0:69f2e28d12c1 | 44 | |
ubhat | 6:f8194e691dd4 | 45 | extern DigitalIn PC0; // Used for Push button application demo |
ubhat | 6:f8194e691dd4 | 46 | |
ubhat | 0:69f2e28d12c1 | 47 | extern SX1272MB2xAS Radio; |
ubhat | 0:69f2e28d12c1 | 48 | |
ubhat | 0:69f2e28d12c1 | 49 | typedef enum |
ubhat | 0:69f2e28d12c1 | 50 | { |
ubhat | 0:69f2e28d12c1 | 51 | MOTE_VERSION_NONE = 0, |
ubhat | 0:69f2e28d12c1 | 52 | MOTE_VERSION_2, |
ubhat | 0:69f2e28d12c1 | 53 | MOTE_VERSION_3, |
ubhat | 0:69f2e28d12c1 | 54 | }MoteVersion_t; |
ubhat | 0:69f2e28d12c1 | 55 | |
ubhat | 0:69f2e28d12c1 | 56 | |
ubhat | 0:69f2e28d12c1 | 57 | /*! |
ubhat | 0:69f2e28d12c1 | 58 | * \brief Initializes the target board peripherals. |
ubhat | 0:69f2e28d12c1 | 59 | */ |
ubhat | 0:69f2e28d12c1 | 60 | void BoardInit( void ); |
ubhat | 0:69f2e28d12c1 | 61 | |
ubhat | 0:69f2e28d12c1 | 62 | /*! |
ubhat | 0:69f2e28d12c1 | 63 | * \brief Measure the Battery level |
ubhat | 0:69f2e28d12c1 | 64 | * |
ubhat | 0:69f2e28d12c1 | 65 | * \retval value battery level ( 0: very low, 254: fully charged ) |
ubhat | 0:69f2e28d12c1 | 66 | */ |
ubhat | 0:69f2e28d12c1 | 67 | uint8_t BoardGetBatteryLevel( void ); |
ubhat | 0:69f2e28d12c1 | 68 | |
ubhat | 0:69f2e28d12c1 | 69 | /*! |
ubhat | 0:69f2e28d12c1 | 70 | * \brief Measure the Battery voltage |
ubhat | 0:69f2e28d12c1 | 71 | * |
ubhat | 0:69f2e28d12c1 | 72 | * \retval value battery voltage in volts |
ubhat | 0:69f2e28d12c1 | 73 | */ |
ubhat | 0:69f2e28d12c1 | 74 | float BoardGetBatteryVoltage( void ); |
ubhat | 0:69f2e28d12c1 | 75 | |
ubhat | 0:69f2e28d12c1 | 76 | /*! |
ubhat | 0:69f2e28d12c1 | 77 | * Returns a pseudo random seed generated using the MCU Unique ID |
ubhat | 0:69f2e28d12c1 | 78 | * |
ubhat | 0:69f2e28d12c1 | 79 | * \retval seed Generated pseudo random seed |
ubhat | 0:69f2e28d12c1 | 80 | */ |
ubhat | 0:69f2e28d12c1 | 81 | uint32_t BoardGetRandomSeed( void ); |
ubhat | 0:69f2e28d12c1 | 82 | |
ubhat | 0:69f2e28d12c1 | 83 | /*! |
ubhat | 0:69f2e28d12c1 | 84 | * \brief Generates Lower 32 bits of DEVEUI using 96 bits unique device ID |
ubhat | 0:69f2e28d12c1 | 85 | * |
ubhat | 0:69f2e28d12c1 | 86 | * \param [IN] id Pointer to an array that will contain the Unique ID |
ubhat | 0:69f2e28d12c1 | 87 | */ |
ubhat | 0:69f2e28d12c1 | 88 | void BoardGetDevEUI( uint8_t *id ); |
ubhat | 0:69f2e28d12c1 | 89 | |
ubhat | 0:69f2e28d12c1 | 90 | /*! |
ubhat | 0:69f2e28d12c1 | 91 | * \brief Gets the board 64 bits unique ID |
ubhat | 0:69f2e28d12c1 | 92 | * |
ubhat | 0:69f2e28d12c1 | 93 | * \param [IN] id Pointer to an array that will contain the Unique ID |
ubhat | 0:69f2e28d12c1 | 94 | */ |
ubhat | 0:69f2e28d12c1 | 95 | void BoardGetUniqueId( uint8_t *id ); |
ubhat | 0:69f2e28d12c1 | 96 | |
ubhat | 0:69f2e28d12c1 | 97 | #endif // __BOARD_H__ |