MAX20361 System Demo with Low Power 2 mode

Dependencies:   SX1276GenericLib USBDevice

Fork of NonPingPong_PICO_LoRa by Walter Luu

Revision:
3:85fc843a9d7d
Child:
6:51f492ca61a2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SX1276GenericPingPong/GenericPingPong2.h	Mon Oct 12 21:55:22 2020 +0000
@@ -0,0 +1,111 @@
+/*
+ / _____)             _              | |
+( (____  _____ ____ _| |_ _____  ____| |__
+ \____ \| ___ |    (_   _) ___ |/ ___)  _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+    ( C )2014 Semtech
+
+Description: Contains the callbacks for the IRQs and any application related details
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainer: Miguel Luis and Gregory Cristian
+*/
+
+/*
+ * This file contains a copy of the master content sx1276PingPong
+ * with adaption for the SX1276Generic environment
+ * (c) 2017 Helmut Tschemernjak
+ * 30826 Garbsen (Hannover) Germany
+ */
+ 
+#ifndef __SX1276PINGPONG_H__
+#define __SX1276PINGPONG_H__
+
+#include "global_buffers.h"
+#include "USBSerial.h"
+/*
+#ifdef FEATURE_LORA
+int SX1276PingPong(void);
+#else
+#define  SX1276PingPong(x)   void()
+#endif
+*/
+
+
+const uint8_t PingMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'I', 'N', 'G'};// "PING";  // 255, 255, 0, 0, 80, 73, 78, 71
+const uint8_t PongMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'O', 'N', 'G'};// "PONG";  // 255, 255, 0, 0, 80, 79, 78, 71
+
+// This keeps track of how many times a transmission times out.
+static int RxTimeoutCount = 0;
+
+/*!
+ * @brief Function that sets up the LoRa radio device
+ */
+int SX1276PingPongSetup(uint8_t *BufferTxFromMain, uint8_t *BufferRxFromMain, USBSerial *_pc);
+
+/*!
+ * @brief Function that is called in main program to handle LoRa communications
+ */
+int SX1276PingPong(void);
+
+/*!
+ * @brief Function that is called in the Slave/Sensor node to send sensor data
+ */
+int SX1276SensorSend(void);
+
+/*!
+ * @brief Function that is called in the Master/Gateway to receive sensor data
+ */
+int SX1276GateWayReceive(int TimeOut);
+
+/*!
+ * @brief Function that is computes time on air for transmission
+ */
+int TimeOnAirSend(void);
+
+/*
+ * Callback functions prototypes
+ */
+/*!
+ * @brief Function to be executed on Radio Tx Done event
+ */
+void OnTxDone(void *radio, void *userThisPtr, void *userData);
+
+/*!
+ * @brief Function to be executed on Radio Rx Done event
+ */
+void OnRxDone(void *radio, void *userThisPtr, void *userData, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
+
+/*!
+ * @brief Function executed on Radio Tx Timeout event
+ */
+void OnTxTimeout(void *radio, void *userThisPtr, void *userData);
+
+/*!
+ * @brief Function executed on Radio Rx Timeout event
+ */
+void OnRxTimeout(void *radio, void *userThisPtr, void *userData);
+
+/*!
+ * @brief Function executed on Radio Rx Error event
+ */
+void OnRxError(void *radio, void *userThisPtr, void *userData);
+
+/*!
+ * @brief Function executed on Radio Fhss Change Channel event
+ */
+void OnFhssChangeChannel(void *radio, void *userThisPtr, void *userData, uint8_t channelIndex);
+
+/*!
+ * @brief Function executed on CAD Done event
+ */
+void OnCadDone(void *radio, void *userThisPtr, void *userData);
+
+/*! 
+ * @brief Returns how many times a transmition is not received
+ */
+int numOfRxTimeouts();
+
+#endif // __MAIN_H__
\ No newline at end of file