1 /*! 2 * \file board.h 3 * 4 * \brief Target board general functions implementation 5 * 6 * \copyright Revised BSD License, see section \ref LICENSE. 7 * 8 * \code 9 * ______ _ 10 * / _____) _ | | 11 * ( (____ _____ ____ _| |_ _____ ____| |__ 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 * _____) ) ____| | | || |_| ____( (___| | | | 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 * (C)2013-2017 Semtech 16 * 17 * \endcode 18 * 19 * \author Miguel Luis ( Semtech ) 20 * 21 * \author Gregory Cristian ( Semtech ) 22 */ 23 #ifndef __BOARD_H__ 24 #define __BOARD_H__ 25 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 31 #include <stdint.h> 32 #include "utilities.h" 33 /*! 34 * Possible power sources 35 */ 36 enum BoardPowerSources 37 { 38 USB_POWER = 0, 39 BATTERY_POWER, 40 }; 41 42 /*! 43 * \brief Initializes the mcu. 44 */ 45 void BoardInitMcu( void ); 46 47 /*! 48 * \brief Resets the mcu. 49 */ 50 void BoardResetMcu( void ); 51 52 /*! 53 * \brief Initializes the boards peripherals. 54 */ 55 void BoardInitPeriph( void ); 56 57 /*! 58 * \brief De-initializes the target board peripherals to decrease power 59 * consumption. 60 */ 61 void BoardDeInitMcu( void ); 62 63 /*! 64 * \brief Gets the current potentiometer level value 65 * 66 * \retval value Potentiometer level ( value in percent ) 67 */ 68 uint8_t BoardGetPotiLevel( void ); 69 70 /*! 71 * \brief Measure the Battery voltage 72 * 73 * \retval value battery voltage in volts 74 */ 75 uint32_t BoardGetBatteryVoltage( void ); 76 77 /*! 78 * \brief Get the current battery level 79 * 80 * \retval value battery level [ 0: USB, 81 * 1: Min level, 82 * x: level 83 * 254: fully charged, 84 * 255: Error] 85 */ 86 uint8_t BoardGetBatteryLevel( void ); 87 88 /*! 89 * \brief Get the current MCU temperature in degree celcius * 256 90 * 91 * \retval temperature * 256 92 */ 93 int16_t BoardGetTemperature( void ); 94 95 /*! 96 * Returns a pseudo random seed generated using the MCU Unique ID 97 * 98 * \retval seed Generated pseudo random seed 99 */ 100 uint32_t BoardGetRandomSeed( void ); 101 102 /*! 103 * \brief Gets the board 64 bits unique ID 104 * 105 * \param [IN] id Pointer to an array that will contain the Unique ID 106 */ 107 void BoardGetUniqueId( uint8_t *id ); 108 109 /*! 110 * \brief Manages the entry into ARM cortex deep-sleep mode 111 */ 112 void BoardLowPowerHandler( void ); 113 114 /*! 115 * \brief Get the board power source 116 * 117 * \retval value power source [0: USB_POWER, 1: BATTERY_POWER] 118 */ 119 uint8_t GetBoardPowerSource( void ); 120 121 /*! 122 * \brief Get the board version 123 * 124 * \retval value Version 125 */ 126 Version_t BoardGetVersion( void ); 127 128 #ifdef __cplusplus 129 } 130 #endif 131 132 #endif // __BOARD_H__ 133