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.
Fork of SX1272PingPong by
Revision 15:3365ba2777d2, committed 2016-04-03
- Comitter:
- emcu
- Date:
- Sun Apr 03 17:40:50 2016 +0000
- Parent:
- 14:62abee5e269d
- Commit message:
- Demo for Semtech Lora SX1272MB2xAS 868MHz and; NUCLEO-F401RE (STM Cortex M4); ; by www.emcu.it; ; Date: Mar.2016; Ver.: 1.0.1; Project name: LORA-SX1272MB2xAS-PP
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Mar 20 00:07:29 2016 +0000
+++ b/main.cpp Sun Apr 03 17:40:50 2016 +0000
@@ -5,7 +5,8 @@
by www.emcu.it
Date: Mar.2016
- Ver.: 1.0.0
+ Ver.: 1.0.1
+ Project name: LORA-SX1272MB2xAS-PP
Note:
The original project is here: https://developer.mbed.org/components/SX1272MB2xAS/
@@ -52,16 +53,21 @@
#define USE_MODEM_LORA 1
#define USE_MODEM_FSK !USE_MODEM_LORA
+/* NOTE
+ LORA_BANDWIDTH=2 & LORA_SPREADING_FACTOR=7 == MaxSpeed 41Kbit
+ LORA_BANDWIDTH=1 & LORA_SPREADING_FACTOR=12 == MediumSpeed
+*/
+
#define RF_FREQUENCY 868000000 // Hz
#define TX_OUTPUT_POWER 14 // 14 dBm
#if USE_MODEM_LORA == 1
- #define LORA_BANDWIDTH 2 // [0: 125 kHz,
+ #define LORA_BANDWIDTH 0 //2 // [0: 125 kHz,
// 1: 250 kHz,
// 2: 500 kHz,
// 3: Reserved]
- #define LORA_SPREADING_FACTOR 7 // [SF7..SF12]
+ #define LORA_SPREADING_FACTOR 11 //7 // [SF7..SF12]
#define LORA_CODINGRATE 1 // [1: 4/5,
// 2: 4/6,
// 3: 4/7,
@@ -135,8 +141,8 @@
*/
SX1272MB2xAS Radio( NULL );
-const uint8_t PingMsg[] = "PING";
-const uint8_t PongMsg[] = "PONG";
+const uint8_t PingMsg[] = "em_PING";
+const uint8_t PongMsg[] = "em_PONG";
uint16_t BufferSize = BUFFER_SIZE;
uint8_t Buffer[BUFFER_SIZE];
@@ -150,6 +156,15 @@
bool isMaster = true;
pc.printf("\n\n\rModified by: http://www.wmcu.it \n\n\r" );
+
+ pc.printf("\n\r RF_FREQUENCY: %d Hz", RF_FREQUENCY);
+ pc.printf("\n\r TX_OUTPUT_POWER: %d dBm", TX_OUTPUT_POWER);
+ pc.printf("\n\r LORA_BANDWIDTH: %d -> 0==125KHz, 1==250KHz, 2==500KHz, 3==Reserved", LORA_BANDWIDTH);
+ pc.printf("\n\r LORA_SPREADING_FACTOR: %d (SF7..SF12)", LORA_SPREADING_FACTOR);
+ pc.printf("\n\r LORA_CODINGRATE: %d", LORA_CODINGRATE);
+ pc.printf(" -> 1==4/5; 2==4/6; 3==4/7; 4==4/8\n\r");
+
+
pc.printf("\n\rSee this link: https://developer.mbed.org/components/SX1272MB2xAS/ \n\rfor original example.\n\r ");
debug( "\n\n\r SX1272 Ping Pong Demo Application \n\n\r" );
@@ -226,7 +241,7 @@
if( strncmp( ( const char* )Buffer, ( const char* )PongMsg, 4 ) == 0 )
{
led = !led;
- debug( "...Pong\r\n" );
+ debug( "...em_Pong\r\n" );
// Send the next PING frame
strcpy( ( char* )Buffer, ( char* )PingMsg );
// We fill the buffer with numbers for the payload
@@ -239,7 +254,7 @@
}
else if( strncmp( ( const char* )Buffer, ( const char* )PingMsg, 4 ) == 0 )
{ // A master already exists then become a slave
- debug( "...Ping\r\n" );
+ debug( "...em_Ping\r\n" );
led = !led;
isMaster = false;
// Send the next PONG frame
@@ -266,7 +281,7 @@
if( strncmp( ( const char* )Buffer, ( const char* )PingMsg, 4 ) == 0 )
{
led = !led;
- debug( "...Ping\r\n" );
+ debug( "...em_Ping\r\n" );
// Send the reply to the PING string
strcpy( ( char* )Buffer, ( char* )PongMsg );
// We fill the buffer with numbers for the payload
@@ -290,7 +305,7 @@
led = !led;
if( isMaster == true )
{
- debug( "Ping...\r\n" );
+ debug( "em_Ping...\r\n" );
}
else
{
