this is avaiable project
Fork of LoRaMacLib by
Diff: board/board.h
- Revision:
- 0:9be122c18509
diff -r 000000000000 -r 9be122c18509 board/board.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/board/board.h Wed Aug 12 14:08:29 2015 +0000 @@ -0,0 +1,85 @@ +/* + / _____) _ | | +( (____ _____ ____ _| |_ _____ ____| |__ + \____ \| ___ | (_ _) ___ |/ ___) _ \ + _____) ) ____| | | || |_| ____( (___| | | | +(______/|_____)_|_|_| \__)_____)\____)_| |_| + (C)2013 Semtech + +Description: Target board general functions implementation + +License: Revised BSD License, see LICENSE.TXT file include in the project + +Maintainer: Miguel Luis and Gregory Cristian +*/ +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#include "mbed.h" +#include "timer.h" +#include "debug.h" + +/*! + * NULL definition + */ +#ifndef NULL + #define NULL ( ( void * )0 ) +#endif + +/*! + * Generic definition + */ +#ifndef SUCCESS +#define SUCCESS 1 +#endif + +#ifndef FAIL +#define FAIL 0 +#endif + +/*! + * Unique Devices IDs register set ( STM32L1xxx ) + */ +#define ID1 ( 0x1FF80050 ) +#define ID2 ( 0x1FF80054 ) +#define ID3 ( 0x1FF80064 ) + +/*! + * Random seed generated using the MCU Unique ID + */ +#define RAND_SEED ( ( *( uint32_t* )ID1 ) ^ \ + ( *( uint32_t* )ID2 ) ^ \ + ( *( uint32_t* )ID3 ) ) + +/*! + * \brief Initializes the target board peripherals. + */ +void BoardInitMcu( void ); + +/*! + * \brief Initializes the boards peripherals. + */ +void BoardInitPeriph( void ); + +/*! + * \brief De-initializes the target board peripherals to decrease power + * consumption. + */ +void BoardDeInitMcu( void ); + +/*! + * \brief Measure the Battery level + * + * \retval value battery level ( 0: very low, 254: fully charged ) + */ +uint8_t BoardMeasureBatterieLevel( void ); + +/*! + * \brief Gets the board 64 bits unique ID + * + * \param [IN] id Pointer to an array that will contain the Unique ID + */ +void BoardGetUniqueId( uint8_t *id ); + + +#endif // __BOARD_H__