Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SX1276GenericLib USBDevice
Fork of NonPingPong_PICO_LoRa by
GenericPingPong2.h
00001 /* 00002 / _____) _ | | 00003 ( (____ _____ ____ _| |_ _____ ____| |__ 00004 \____ \| ___ | (_ _) ___ |/ ___) _ \ 00005 _____) ) ____| | | || |_| ____( (___| | | | 00006 (______/|_____)_|_|_| \__)_____)\____)_| |_| 00007 ( C )2014 Semtech 00008 00009 Description: Contains the callbacks for the IRQs and any application related details 00010 00011 License: Revised BSD License, see LICENSE.TXT file include in the project 00012 00013 Maintainer: Miguel Luis and Gregory Cristian 00014 */ 00015 00016 /* 00017 * This file contains a copy of the master content sx1276PingPong 00018 * with adaption for the SX1276Generic environment 00019 * (c) 2017 Helmut Tschemernjak 00020 * 30826 Garbsen (Hannover) Germany 00021 */ 00022 00023 #ifndef __SX1276PINGPONG_H__ 00024 #define __SX1276PINGPONG_H__ 00025 00026 #include "global_buffers.h" 00027 #include "USBSerial.h" 00028 /* 00029 #ifdef FEATURE_LORA 00030 int SX1276PingPong(void); 00031 #else 00032 #define SX1276PingPong(x) void() 00033 #endif 00034 */ 00035 00036 00037 //const uint8_t PingMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'I', 'N', 'G'};// "PING"; // 255, 255, 0, 0, 80, 73, 78, 71 00038 const uint8_t PingMsg[] = {0xff}; 00039 //const uint8_t PongMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'O', 'N', 'G'};// "PONG"; // 255, 255, 0, 0, 80, 79, 78, 71 00040 const uint8_t PongMsg[] = {0x00}; 00041 00042 // This keeps track of how many times a transmission times out. 00043 static int RxTimeoutCount = 0; 00044 00045 /*! 00046 * @brief Function that sets up the LoRa radio device 00047 */ 00048 int SX1276PingPongSetup(uint8_t *BufferTxFromMain, uint8_t *BufferRxFromMain, USBSerial *_pc); 00049 00050 /*! 00051 * @brief Function that is called in main program to handle LoRa communications 00052 */ 00053 int SX1276PingPong(void); 00054 00055 /*! 00056 * @brief Function that is called in the Slave/Sensor node to send sensor data 00057 */ 00058 int SX1276SensorSend(void); 00059 00060 /*! 00061 * @brief Function that is called in the Master/Gateway to receive sensor data 00062 */ 00063 int SX1276GateWayReceive(int TimeOut); 00064 00065 /*! 00066 * @brief Function that is computes time on air for transmission 00067 */ 00068 int TimeOnAirSend(void); 00069 00070 /* 00071 * Callback functions prototypes 00072 */ 00073 /*! 00074 * @brief Function to be executed on Radio Tx Done event 00075 */ 00076 void OnTxDone(void *radio, void *userThisPtr, void *userData); 00077 00078 /*! 00079 * @brief Function to be executed on Radio Rx Done event 00080 */ 00081 void OnRxDone(void *radio, void *userThisPtr, void *userData, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ); 00082 00083 /*! 00084 * @brief Function executed on Radio Tx Timeout event 00085 */ 00086 void OnTxTimeout(void *radio, void *userThisPtr, void *userData); 00087 00088 /*! 00089 * @brief Function executed on Radio Rx Timeout event 00090 */ 00091 void OnRxTimeout(void *radio, void *userThisPtr, void *userData); 00092 00093 /*! 00094 * @brief Function executed on Radio Rx Error event 00095 */ 00096 void OnRxError(void *radio, void *userThisPtr, void *userData); 00097 00098 /*! 00099 * @brief Function executed on Radio Fhss Change Channel event 00100 */ 00101 void OnFhssChangeChannel(void *radio, void *userThisPtr, void *userData, uint8_t channelIndex); 00102 00103 /*! 00104 * @brief Function executed on CAD Done event 00105 */ 00106 void OnCadDone(void *radio, void *userThisPtr, void *userData); 00107 00108 /*! 00109 * @brief Returns how many times a transmition is not received 00110 */ 00111 int numOfRxTimeouts(); 00112 00113 bool SX1276MasterCheckForNewData(void); 00114 00115 void SX1276SlaveSendData(void); 00116 00117 #endif // __MAIN_H__
Generated on Mon Jul 18 2022 15:25:00 by
1.7.2
