The NSL01 library contains the software stack to control the NSL01 LoRaWAN shield from mCloud System GmbH. The NSL01 is a professional plug & play LoRaWAN shield for a wide range of STM32 Nucleo-64 boards with Arduino Uno Rev 3 connectivity. For more information about the NSL01 LoRaWAN shield have a look at: http://www.mcloud-systems.com/nsl01-lorawan-nucleo-arduino-shield
Fork of NSL01 by
CRC16.h
00001 /** 00002 ******************************************************************************** 00003 * @file CRC16.h 00004 * 00005 * @brief Functions for NSL01 class to calculate and check CRC16. 00006 * 00007 * @brief For more information about the NSL01 LoRaWAN shield: 00008 * http://www.mcloud-systems.com/nsl01-lorawan-nucleo-arduino-shield 00009 * 00010 * @note The CRC16 files are included in the dependencies directory of the 00011 * project and these files are necessary for the NSL01 class! 00012 * 00013 * @author - 00014 * @version V1.0 00015 * @date 20-June-2018 00016 ******************************************************************************** 00017 */ 00018 00019 #ifndef __CRC16_H__ 00020 #define __CRC16_H__ 00021 00022 //------------------------------------------------------------------------------ 00023 // 00024 // Include Files 00025 // 00026 //------------------------------------------------------------------------------ 00027 00028 #include <stdint.h> 00029 00030 //------------------------------------------------------------------------------ 00031 // 00032 // Section Defines 00033 // 00034 //------------------------------------------------------------------------------ 00035 00036 #define CRC16_INIT_VALUE 0xFFFF //-Initial value for CRC algorithm 00037 #define CRC16_GOOD_VALUE 0x0F47 //-Constant compare value for check 00038 #define CRC16_POLYNOM 0x8408 //-16-BIT CRC CCITT POLYNOM 00039 00040 //------------------------------------------------------------------------------ 00041 // 00042 // Section Declarations 00043 // 00044 //------------------------------------------------------------------------------ 00045 00046 typedef uint8_t UINT8; 00047 typedef uint16_t UINT16; 00048 00049 //------------------------------------------------------------------------------ 00050 // 00051 // Function Prototypes 00052 // 00053 //------------------------------------------------------------------------------ 00054 00055 00056 /** Function to calculate CRC16. 00057 * 00058 * @note This function calculates the one's complement of the standard 16-BIT 00059 * CRC CCITT polynomial G(x) = 1 + x^5 + x^12 + x^16. 00060 * 00061 * @param data : Input sequency 00062 * @param length : Length of input sequence 00063 * @param initVal : Inital value 00064 * 00065 * @returns calculated checksum. 00066 */ 00067 UINT16 00068 CRC16_Calc (UINT8* data, 00069 UINT16 length, 00070 UINT16 initVal); 00071 00072 00073 /** Function to check CRC16. 00074 * 00075 * @note This function checks a data block with attached CRC16. 00076 * 00077 * @param data : Input sequency 00078 * @param length : Length of input sequence 00079 * @param initVal : Inital value 00080 * 00081 * @returns true on success, false on error 00082 */ 00083 bool 00084 CRC16_Check (UINT8* data, 00085 UINT16 length, 00086 UINT16 initVal); 00087 00088 00089 #endif // __CRC16_H__ 00090 00091 //------------------------------------------------------------------------------ 00092 // end of file 00093 //------------------------------------------------------------------------------
Generated on Tue Jul 12 2022 20:20:04 by
1.7.2
