The NSL01 library contains all functions for controlling 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: http://www.mcloud-systems.com/nsl01-lorawan-nucleo-arduino-shield

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SLIP.h Source File

SLIP.h

Go to the documentation of this file.
00001 /**
00002 ********************************************************************************
00003 * @file     SLIP.h
00004 *
00005 * @brief    Functions for NSL01 class for SLIP encoder/decoder.
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 SLIP 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 SLIP_H
00020 #define SLIP_H
00021 
00022 //------------------------------------------------------------------------------
00023 //
00024 // Include Files
00025 //
00026 //------------------------------------------------------------------------------
00027 
00028 #include <stdint.h>
00029 
00030 //------------------------------------------------------------------------------
00031 //
00032 // Section Defines
00033 //
00034 //------------------------------------------------------------------------------
00035 
00036 //--SLIP protocol characters
00037 #define SLIP_END                    0xC0
00038 #define SLIP_ESC                    0xDB
00039 #define SLIP_ESC_END                0xDC
00040 #define SLIP_ESC_ESC                0xDD
00041 
00042 //------------------------------------------------------------------------------
00043 //
00044 //  Section Declarations
00045 //
00046 //------------------------------------------------------------------------------
00047 
00048 typedef uint8_t     UINT8;
00049 
00050 //------------------------------------------------------------------------------
00051 //
00052 //  Function Prototypes
00053 //
00054 //------------------------------------------------------------------------------
00055 
00056 
00057 /** SLIP message receiver callback defintion.
00058 *
00059 *   @param message  : Pointer to message
00060 *   @param length   : Length of message
00061 */
00062 typedef UINT8*  (*TSLIP_CbRxMessage)(UINT8* message, int length);
00063 
00064 
00065 /** Function to init SLIP decoder.
00066 *
00067 *   @param cbRxMessage : Message receiver callback
00068 */
00069 void
00070 SLIP_Init(TSLIP_CbRxMessage cbRxMessage);
00071 
00072 
00073 /** Function to init Rx buffer and enable receiver/decoder.
00074 *
00075 *   @param rxBuffer     : Pointer to Rx message buffer
00076 *   @param rxBufferSize : Rx message buffer size
00077 *
00078 *   @returns true on success, false on error
00079 */
00080 bool
00081 SLIP_SetRxBuffer(UINT8* rxBuffer, int rxBufferSize);
00082 
00083 
00084 /** Function to encode outgoing data.
00085 *
00086 *   @param dstBuffer    : Pointer to destination buffer
00087 *   @param txBufferSize : Tx message buffer size
00088 *   @param srcData      : Pointer to source data
00089 *   @param srcLength    : Length of source data
00090 *
00091 *   @returns >=0 on success, -1 on error
00092 */
00093 int
00094 SLIP_EncodeData(UINT8* dstBuffer, int txBufferSize, UINT8* srcData, int srcLength);
00095 
00096 
00097 /** Function to process/decode received byte stream.
00098 *
00099 *   @param srcData      : Pointer to source data
00100 *   @param srcLength    : Length of source data
00101 */
00102 void
00103 SLIP_DecodeData(UINT8*  srcData, int srcLength);
00104 
00105 #endif  // SLIP_H
00106 
00107 //------------------------------------------------------------------------------
00108 // end of file
00109 //------------------------------------------------------------------------------