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: SX1276Lib1 WakeUp mbed-src
Fork of SX1276PingPong by
Revision 16:cb5523c208e6, committed 2016-12-13
- Comitter:
- lzbpli
- Date:
- Tue Dec 13 06:43:55 2016 +0000
- Parent:
- 15:ddd519fefbe8
- Commit message:
- tst
Changed in this revision
--- a/SX1276Lib.lib Thu Jul 07 06:49:15 2016 +0000 +++ b/SX1276Lib.lib Tue Dec 13 06:43:55 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/SX1276Lib/#8fbb352c7142 +https://developer.mbed.org/users/lzbpli/code/SX1276Lib1/#712d195d97ee
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WakeUp.lib Tue Dec 13 06:43:55 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/WakeUp/#49ca85e8822f
--- a/main.cpp Thu Jul 07 06:49:15 2016 +0000
+++ b/main.cpp Tue Dec 13 06:43:55 2016 +0000
@@ -1,6 +1,7 @@
#include "mbed.h"
#include "main.h"
#include "sx1276-hal.h"
+#include "WakeUp.h"
//#include "debug.h"
/* Set this flag to '1' to display debug messages on the console */
@@ -10,12 +11,12 @@
#define USE_MODEM_LORA 1
#define USE_MODEM_FSK !USE_MODEM_LORA
-#define RF_FREQUENCY 471899946 // Hz
-#define TX_OUTPUT_POWER 20 // 14 dBm
+#define RF_FREQUENCY 471900000 // Hz
+#define TX_OUTPUT_POWER 20 // 14 dBm
#if USE_MODEM_LORA == 1
-#define LORA_BANDWIDTH 0 // [0: 125 kHz,
+#define LORA_BANDWIDTH 1 // [0: 125 kHz,
// 1: 250 kHz,
// 2: 500 kHz,
// 3: Reserved]
@@ -71,6 +72,7 @@
CAD,
CAD_DONE
+
} AppStates_t;
volatile AppStates_t State = LOWPOWER;
@@ -90,17 +92,23 @@
uint16_t BufferSize = BUFFER_SIZE;
uint8_t Buffer[BUFFER_SIZE];
-
int16_t RssiValue = 0.0;
int8_t SnrValue = 0.0;
Serial pc(PB_6, PB_7);
+void srprintf(uint8_t *load,uint8_t size)
+{
+ pc.printf(":");
+ for(int i=0; i<size; i++) {
+ pc.printf("%x ",load[i]);
+ }
+ // pc.printf("size:%drssi:%dsnr:%d\r\n",size,rssi,snr);
+}
int main()
{
uint8_t i;
bool isMaster = true;
pc.printf("Hello World !\n");
//debug( "\n\n\r SX1276 Ping Pong Demo Application \n\n\r" );
-
// Initialize Radio driver
RadioEvents.TxDone = OnTxDone;
RadioEvents.RxDone = OnRxDone;
@@ -163,10 +171,11 @@
// debug_if( DEBUG_MESSAGE, "Starting Ping-Pong loop\r\n" );
led = 0;
-
+ // WakeUp::calibrate();
Radio.Rx( RX_TIMEOUT_VALUE );
-
- while( 1 ) {
+ while( 0 ) {
+ // WakeUp::set_ms(6000);
+ // deepsleep();
switch( State ) {
case RX:
// debugs((char* )Buffer,sizeof(Buffer));
@@ -287,6 +296,7 @@
break;
}
}
+ // while(1);
}
void OnTxDone( void )
@@ -309,6 +319,8 @@
// debug_if( DEBUG_MESSAGE, "> OnRxDone\n\r" );
pc.printf("> OnRxDone\r\n");
pc.printf("size:%d rssi:%d snr:%d",size,rssi,snr);
+ srprintf(payload,sizeof(payload));
+ Radio.Rx( RX_TIMEOUT_VALUE );
}
void OnTxTimeout( void )
@@ -317,6 +329,7 @@
State = TX_TIMEOUT;
// debug_if( DEBUG_MESSAGE, "> OnTxTimeout\n\r" );
pc.printf("> OnTxTimeout\r\n");
+ Radio.Rx( RX_TIMEOUT_VALUE );
}
void OnRxTimeout( void )
@@ -326,6 +339,7 @@
State = RX_TIMEOUT;
// debug_if( DEBUG_MESSAGE, "> OnRxTimeout\n\r" );
pc.printf("> OnRxTimeout\r\n");
+ Radio.Rx( RX_TIMEOUT_VALUE );
}
void OnRxError( void )
@@ -334,5 +348,6 @@
State = RX_ERROR;
// debug_if( DEBUG_MESSAGE, "> OnRxError\n\r" );
pc.printf("> OnRxError\r\n");
+ Radio.Rx( RX_TIMEOUT_VALUE );
}
--- a/mbed-src.lib Thu Jul 07 06:49:15 2016 +0000 +++ b/mbed-src.lib Tue Dec 13 06:43:55 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-src/#b0d178e9fa10 +https://developer.mbed.org/users/lzbpli/code/mbed-src/#b0d178e9fa10
