A very easy to understand LoRaWAN-node code.
Dependencies: LoRaWAN-lib SX1272Lib X_NUCLEO_IKS01A1 mbed
Important parameters:
• In comissioning.h: DevEUI, AppEUI, AppKEY, DevADR, NwksKEY, AppsKEY, OTAA and public network. Frequency and channel block to use, confirmed or unconfirmed messages, app port, app data size and OTAA and Tx duty cycles.
• In LoRaMac.h: Maximum payload and MAC commands length, receive delays, max FCNT, adr ack limit, timeout and delay, max ack retries, rssi threshold and sync words.
• In LoRaMac.cpp: Maximum payload, MAC commands and FRMpayload length.
• In LoRaMac-board.h: Tx power, data rates and band settings.
NOTE: Please refer to LoRaWAN regional parameters (page 12 for US band) to know which parameters you can modify.
system/utilities.h
- Committer:
- dgabino
- Date:
- 2018-04-03
- Revision:
- 0:60ff878b27b8
File content as of revision 0:60ff878b27b8:
/* / _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ \____ \| ___ | (_ _) ___ |/ ___) _ \ _____) ) ____| | | || |_| ____( (___| | | | (______/|_____)_|_|_| \__)_____)\____)_| |_| (C)2013 Semtech Description: Helper functions implementation License: Revised BSD License, see LICENSE.TXT file include in the project Maintainer: Miguel Luis and Gregory Cristian */ #ifndef __UTILITIES_H__ #define __UTILITIES_H__ /*! * \brief Returns the minimum value betwen a and b * * \param [IN] a 1st value * \param [IN] b 2nd value * \retval minValue Minimum value */ #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) /*! * \brief Returns the maximum value betwen a and b * * \param [IN] a 1st value * \param [IN] b 2nd value * \retval maxValue Maximum value */ #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) /*! * \brief Returns 2 raised to the power of n * * \param [IN] n power value * \retval result of raising 2 to the power n */ #define POW2( n ) ( 1 << n ) /*! * \brief Initializes the pseudo ramdom generator initial value * * \param [IN] seed Pseudo ramdom generator initial value */ void srand1( uint32_t seed ); /*! * \brief Computes a random number between min and max * * \param [IN] min range minimum value * \param [IN] max range maximum value * \retval random random value in range min..max */ int32_t randr( int32_t min, int32_t max ); /*! * \brief Copies size elements of src array to dst array * * \remark STM32 Standard memcpy function only works on pointers that are aligned * * \param [OUT] dst Destination array * \param [IN] src Source array * \param [IN] size Number of bytes to be copied */ void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size ); /*! * \brief Copies size elements of src array to dst array reversing the byte order * * \param [OUT] dst Destination array * \param [IN] src Source array * \param [IN] size Number of bytes to be copied */ void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size ); /*! * \brief Set size elements of dst array with value * * \remark STM32 Standard memset function only works on pointers that are aligned * * \param [OUT] dst Destination array * \param [IN] value Default value * \param [IN] size Number of bytes to be copied */ void memset1( uint8_t *dst, uint8_t value, uint16_t size ); /*! * \brief Converts a nibble to an hexadecimal character * * \param [IN] a Nibble to be converted * \retval hexChar Converted hexadecimal character */ int8_t Nibble2HexChar( uint8_t a ); #endif // __UTILITIES_H__