this is avaiable project

Dependents:   LoRaWAN_MBED

Fork of LoRaMacLib by LoRa All

Committer:
pzheng
Date:
Tue Apr 19 00:07:13 2016 +0000
Revision:
11:29686c1ac910
Parent:
9:b3ddbad8c5e3
print all the keys in the format of string

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:9be122c18509 1 /*
GregCr 0:9be122c18509 2 / _____) _ | |
GregCr 0:9be122c18509 3 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:9be122c18509 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:9be122c18509 5 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:9be122c18509 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:9be122c18509 7 (C)2013 Semtech
GregCr 0:9be122c18509 8
GregCr 0:9be122c18509 9 Description: Helper functions implementation
GregCr 0:9be122c18509 10
GregCr 0:9be122c18509 11 License: Revised BSD License, see LICENSE.TXT file include in the project
GregCr 0:9be122c18509 12
GregCr 0:9be122c18509 13 Maintainer: Miguel Luis and Gregory Cristian
GregCr 0:9be122c18509 14 */
GregCr 0:9be122c18509 15 #ifndef __UTILITIES_H__
GregCr 0:9be122c18509 16 #define __UTILITIES_H__
GregCr 0:9be122c18509 17
GregCr 0:9be122c18509 18 /*!
GregCr 0:9be122c18509 19 * \brief Returns the minimum value betwen a and b
GregCr 0:9be122c18509 20 *
GregCr 0:9be122c18509 21 * \param [IN] a 1st value
GregCr 0:9be122c18509 22 * \param [IN] b 2nd value
GregCr 0:9be122c18509 23 * \retval minValue Minimum value
GregCr 0:9be122c18509 24 */
GregCr 0:9be122c18509 25 #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
GregCr 0:9be122c18509 26
GregCr 0:9be122c18509 27 /*!
GregCr 0:9be122c18509 28 * \brief Returns the maximum value betwen a and b
GregCr 0:9be122c18509 29 *
GregCr 0:9be122c18509 30 * \param [IN] a 1st value
GregCr 0:9be122c18509 31 * \param [IN] b 2nd value
GregCr 0:9be122c18509 32 * \retval maxValue Maximum value
GregCr 0:9be122c18509 33 */
GregCr 0:9be122c18509 34 #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
GregCr 0:9be122c18509 35
GregCr 0:9be122c18509 36 /*!
GregCr 0:9be122c18509 37 * \brief Returns 2 raised to the power of n
GregCr 0:9be122c18509 38 *
GregCr 0:9be122c18509 39 * \param [IN] n power value
GregCr 0:9be122c18509 40 * \retval result of raising 2 to the power n
GregCr 0:9be122c18509 41 */
GregCr 0:9be122c18509 42 #define POW2( n ) ( 1 << n )
GregCr 0:9be122c18509 43
GregCr 0:9be122c18509 44 /*!
GregCr 0:9be122c18509 45 * \brief Find First Set
GregCr 0:9be122c18509 46 * This function identifies the least significant index or position of the
GregCr 0:9be122c18509 47 * bits set to one in the word
GregCr 0:9be122c18509 48 *
GregCr 0:9be122c18509 49 * \param [in] value Value to find least significant index
GregCr 0:9be122c18509 50 * \retval bitIndex Index of least significat bit at one
GregCr 0:9be122c18509 51 */
GregCr 0:9be122c18509 52 __STATIC_INLINE uint8_t __ffs( uint32_t value )
GregCr 0:9be122c18509 53 {
GregCr 0:9be122c18509 54 return( uint32_t )( 32 - __CLZ( value & ( -value ) ) );
GregCr 0:9be122c18509 55 }
GregCr 0:9be122c18509 56
GregCr 0:9be122c18509 57 /*!
GregCr 0:9be122c18509 58 * \brief Computes a random number between min and max
GregCr 0:9be122c18509 59 *
GregCr 0:9be122c18509 60 * \param [IN] min range minimum value
GregCr 0:9be122c18509 61 * \param [IN] max range maximum value
GregCr 0:9be122c18509 62 * \retval random random value in range min..max
GregCr 0:9be122c18509 63 */
GregCr 0:9be122c18509 64 int32_t randr( int32_t min, int32_t max );
GregCr 0:9be122c18509 65
pzheng 9:b3ddbad8c5e3 66 //Added by pzheng 20151125
pzheng 9:b3ddbad8c5e3 67 void srand1( unsigned int seed );
GregCr 0:9be122c18509 68 /*!
GregCr 0:9be122c18509 69 * \brief Copies size elements of src array to dst array
GregCr 0:9be122c18509 70 *
GregCr 0:9be122c18509 71 * \remark STM32 Standard memcpy function only works on pointers that are aligned
GregCr 0:9be122c18509 72 *
GregCr 0:9be122c18509 73 * \param [OUT] dst Destination array
GregCr 0:9be122c18509 74 * \param [IN] src Source array
GregCr 0:9be122c18509 75 * \param [IN] size Number of bytes to be copied
GregCr 0:9be122c18509 76 */
GregCr 0:9be122c18509 77 void memcpy1( uint8_t *dst, uint8_t *src, uint16_t size );
GregCr 0:9be122c18509 78
GregCr 0:9be122c18509 79 /*!
GregCr 0:9be122c18509 80 * \brief Set size elements of dst array with value
GregCr 0:9be122c18509 81 *
GregCr 0:9be122c18509 82 * \remark STM32 Standard memset function only works on pointers that are aligned
GregCr 0:9be122c18509 83 *
GregCr 0:9be122c18509 84 * \param [OUT] dst Destination array
GregCr 0:9be122c18509 85 * \param [IN] value Default value
GregCr 0:9be122c18509 86 * \param [IN] size Number of bytes to be copied
GregCr 0:9be122c18509 87 */
GregCr 0:9be122c18509 88 void memset1( uint8_t *dst, uint8_t value, uint16_t size );
GregCr 0:9be122c18509 89
GregCr 0:9be122c18509 90
GregCr 0:9be122c18509 91 /*!
GregCr 0:9be122c18509 92 * \brief Converts a nibble to an hexadecimal character
GregCr 0:9be122c18509 93 *
GregCr 0:9be122c18509 94 * \param [IN] a Nibble to be converted
GregCr 0:9be122c18509 95 * \retval hexChar Converted hexadecimal character
GregCr 0:9be122c18509 96 */
GregCr 0:9be122c18509 97 int8_t Nibble2HexChar( uint8_t a );
GregCr 0:9be122c18509 98
GregCr 0:9be122c18509 99 #endif // __UTILITIES_H__