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
SerialDevice.h
00001 /** 00002 ******************************************************************************** 00003 * @file SerialDevice.h 00004 * 00005 * @brief Functions for NSL01 class to communicate with onboard RF radio 00006 * module via UART interface. 00007 * 00008 * @brief For more information about the NSL01 LoRaWAN shield: 00009 * http://www.mcloud-systems.com/nsl01-lorawan-nucleo-arduino-shield 00010 * 00011 * @note The SerialDevice files are included in the dependencies directory of 00012 * the project and these files are necessary for the NSL01 class! 00013 * 00014 * @author mCloud Systems Team 00015 * @version V1.0 00016 * @date 20-June-2018 00017 ******************************************************************************** 00018 */ 00019 00020 #ifndef SERIALDEVICE_H 00021 #define SERIALDEVICE_H 00022 00023 //------------------------------------------------------------------------------ 00024 // 00025 // Include Files 00026 // 00027 //------------------------------------------------------------------------------ 00028 00029 #include "mbed.h" 00030 #include "./dependencies/SLIP.h" 00031 #include <stdint.h> 00032 00033 //------------------------------------------------------------------------------ 00034 // 00035 // Section Defines 00036 // 00037 //------------------------------------------------------------------------------ 00038 00039 #define Baudrate_9600 9600 00040 #define Baudrate_115200 115200 00041 #define DataBits_7 7 00042 #define DataBits_8 8 00043 #define Parity_Even EVENPARITY 00044 #define Parity_None NOPARITY 00045 00046 //#define DEBUG 00047 00048 //------------------------------------------------------------------------------ 00049 // 00050 // Section Declarations 00051 // 00052 //------------------------------------------------------------------------------ 00053 00054 //--Global variables from main 00055 extern Serial comm_pc; 00056 extern Serial comm_LoRa; 00057 00058 //--Define shortcuts for datatypes 00059 typedef uint8_t UINT8; 00060 typedef uint32_t UINT32; 00061 00062 //------------------------------------------------------------------------------ 00063 // 00064 // Function Prototypes 00065 // 00066 //------------------------------------------------------------------------------ 00067 00068 00069 /** Function to open serial device with given parameters. 00070 * 00071 * @note The serial object have to be defined in main.cpp file! 00072 * 00073 * @param baudrate : Baudrate for serial communication 00074 * @param dataBits : Number of data bits for serial communication 00075 */ 00076 void 00077 SerialDevice_Open(UINT32 baudRate, 00078 int dataBits); 00079 00080 00081 /** UART Rx callback function for data reception. 00082 * 00083 */ 00084 void rxCallback(void); 00085 00086 00087 /** Function to transmit a single (wakeup) byte to the RF device. 00088 * 00089 * @param txByte : Tx byte 00090 * 00091 * @returns 1 on success, -1 on error 00092 */ 00093 int 00094 SerialDevice_SendByte(UINT8 txByte); 00095 00096 00097 /** Function to transmit data to the RF device. 00098 * 00099 * @param txBuffer : Pointer to Tx buffer 00100 * @param txLength : Length of Tx buffer 00101 * 00102 * @returns number of Tx bytes on success, -1 on error 00103 */ 00104 int 00105 SerialDevice_SendData(UINT8* txBuffer, 00106 int txLength); 00107 00108 00109 /** Function to manually read data into Rx buffer. 00110 * 00111 * @note This function is not necessary at the moment, because of internal Rx 00112 * callback function! 00113 * 00114 * @param rxBuffer : Pointer to Rx buffer 00115 * @param rxBufferSize : Length of Rx buffer 00116 * 00117 * @returns number of Rx bytes on success, -1 on error 00118 */ 00119 int 00120 SerialDevice_ReadData(UINT8* rxBuffer, 00121 int rxBufferSize); 00122 00123 #endif // SERIALDEVICE_H 00124 00125 //------------------------------------------------------------------------------ 00126 // end of file 00127 //------------------------------------------------------------------------------
Generated on Wed Jul 13 2022 06:29:55 by
1.7.2