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 4:5ece30264cd9, committed 2014-09-19
- Comitter:
- GregCr
- Date:
- Fri Sep 19 14:18:37 2014 +0000
- Parent:
- 3:8b9e2a4df4b5
- Child:
- 5:f2431c4fe3bb
- Commit message:
- created main.h for callback prototype; match library update
Changed in this revision
--- a/SX1276Lib.lib Thu Sep 04 14:04:52 2014 +0000 +++ b/SX1276Lib.lib Fri Sep 19 14:18:37 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/GregCr/code/SX1276Lib/#e7f02929cd3d +http://mbed.org/users/GregCr/code/SX1276Lib/#2b555111463f
--- a/main.cpp Thu Sep 04 14:04:52 2014 +0000
+++ b/main.cpp Fri Sep 19 14:18:37 2014 +0000
@@ -1,16 +1,17 @@
#include "mbed.h"
+#include "main.h"
#include "sx1276-hal.h"
-#include "debug.h"
+#include "mbed_debug.h"
/* Set this flag to '1' to display debug messages on the console */
-#define DEBUG_MESSAGE 0
+#define DEBUG_MESSAGE 1
/* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
-#define USE_MODEM_LORA 1
+#define USE_MODEM_LORA 0
#define USE_MODEM_FSK !USE_MODEM_LORA
-#define RF_FREQUENCY 475000000 // Hz
+#define RF_FREQUENCY 915000000 // Hz
#define TX_OUTPUT_POWER 14 // 14 dBm
#if USE_MODEM_LORA == 1
@@ -56,39 +57,6 @@
#endif
/*
- * Callback functions prototypes
- */
-/*!
- * @brief Function to be executed on Radio Tx Done event
- */
-void OnTxDone( void );
-
-/*!
- * @brief Function to be executed on Radio Rx Done event
- */
-void OnRxDone( uint8_t *payload, uint16_t size, int8_t rssi, int8_t snr );
-
-/*!
- * @brief Function executed on Radio Tx Timeout event
- */
-void OnTxTimeout( void );
-
-/*!
- * @brief Function executed on Radio Rx Timeout event
- */
-void OnRxTimeout( void );
-
-/*!
- * @brief Function executed on Radio Rx Error event
- */
-void OnRxError( void );
-
-/*!
- * @brief Function executed on Radio Fhss Change Channel event
- */
-void OnFhssChangeChannel( uint8_t channelIndex );
-
-/*
* Global variables declarations
*/
typedef RadioState States_t;
@@ -96,7 +64,7 @@
/*
* Global variables declarations
*/
-SX1276MB1xAS Radio( OnTxDone, OnTxTimeout, OnRxDone, OnRxTimeout, OnRxError, NULL );
+SX1276MB1xAS Radio( OnTxDone, OnTxTimeout, OnRxDone, OnRxTimeout, OnRxError, NULL, NULL );
const uint8_t PingMsg[] = "PING";
const uint8_t PongMsg[] = "PONG";
@@ -117,25 +85,25 @@
debug( "\n\r\n\r SX1276 Ping Pong Demo Application \n\r" );
#if defined TARGET_NUCLEO_L152RE
- debug( DEBUG_MESSAGE, " > Nucleo-L152RE Platform <\r\n" );
+ debug( DEBUG_MESSAGE, " > Nucleo-L152RE Platform <\r\n", NULL );
#elif defined TARGET_KL25Z
- debug( DEBUG_MESSAGE, " > KL25Z Platform <\r\n" );
+ debug_if( DEBUG_MESSAGE, " > KL25Z Platform <\r\n", NULL );
#elif defined TARGET_LPC11U6X
- debug( DEBUG_MESSAGE, " > LPC11U6X Platform <\r\n" );
+ debug_if( DEBUG_MESSAGE, " > LPC11U6X Platform <\r\n", NULL );
#else
- debug( DEBUG_MESSAGE, " > Untested Platform <\r\n" );
+ debug_if( DEBUG_MESSAGE, " > Untested Platform <\r\n", NULL );
#endif
if( Radio.DetectBoardType( ) == SX1276MB1LAS )
{
- debug( DEBUG_MESSAGE, "\n\r > Board Type: SX1276MB1LAS < \n\r" );
+ debug_if( DEBUG_MESSAGE, "\n\r > Board Type: SX1276MB1LAS < \n\r", NULL );
}
else
{
- debug( DEBUG_MESSAGE, "\n\r > Board Type: SX1276MB1MAS < \n\r" );
+ debug_if( DEBUG_MESSAGE, "\n\r > Board Type: SX1276MB1MAS < \n\r", NULL );
}
- debug( DEBUG_MESSAGE, " > Chipset Version = 0x%x < \n\r", Radio.Read( REG_VERSION ) );
+ debug_if( DEBUG_MESSAGE, " > Chipset Version = 0x%x < \n\r", Radio.Read( REG_VERSION ) );
Radio.SetChannel( RF_FREQUENCY );
@@ -180,7 +148,7 @@
#endif
- debug( DEBUG_MESSAGE, "Starting Ping-Pong loop\r\n" );
+ debug_if( DEBUG_MESSAGE, "Starting Ping-Pong loop\r\n", NULL );
led = 0;
@@ -347,13 +315,13 @@
void OnTxDone( void )
{
- debug( DEBUG_MESSAGE, "> OnTxDone\n\r" );
+ debug_if( DEBUG_MESSAGE, "> OnTxDone\n\r", NULL );
State = TX;
}
-void OnRxDone( uint8_t *payload, uint16_t size, int8_t rssi, int8_t snr)
+void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
{
- debug( DEBUG_MESSAGE, "> OnRxDone\n\r" );
+ debug_if( DEBUG_MESSAGE, "> OnRxDone\n\r", NULL );
Radio.Sleep( );
BufferSize = size;
memcpy( Buffer, payload, BufferSize );
@@ -364,14 +332,14 @@
void OnTxTimeout( void )
{
- debug( DEBUG_MESSAGE, "> OnTxTimeout\n\r" );
+ debug_if( DEBUG_MESSAGE, "> OnTxTimeout\n\r", NULL );
Radio.Sleep( );
State = TX_TIMEOUT;
}
void OnRxTimeout( void )
{
- debug( DEBUG_MESSAGE, "> OnRxTimeout\n\r" );
+ debug_if( DEBUG_MESSAGE, "> OnRxTimeout\n\r", NULL );
Radio.Sleep( );
Buffer[ BufferSize ] = 0;
State = RX_TIMEOUT;
@@ -379,7 +347,7 @@
void OnRxError( void )
{
- debug( DEBUG_MESSAGE, "> OnRxError\n\r" );
+ debug_if( DEBUG_MESSAGE, "> OnRxError\n\r", NULL );
Radio.Sleep( );
State = RX_ERROR;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Fri Sep 19 14:18:37 2014 +0000 @@ -0,0 +1,56 @@ +/* + / _____) _ | | +( (____ _____ ____ _| |_ _____ ____| |__ + \____ \| ___ | (_ _) ___ |/ ___) _ \ + _____) ) ____| | | || |_| ____( (___| | | | +(______/|_____)_|_|_| \__)_____)\____)_| |_| + �2013 Semtech + +Description: SX1276 FSK modem registers and bits definitions + +License: Revised BSD License, see LICENSE.TXT file include in the project + +Maintainer: Miguel Luis and Gregory Cristian +*/ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +/* + * Callback functions prototypes + */ +/*! + * @brief Function to be executed on Radio Tx Done event + */ +void OnTxDone( void ); + +/*! + * @brief Function to be executed on Radio Rx Done event + */ +void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ); + +/*! + * @brief Function executed on Radio Tx Timeout event + */ +void OnTxTimeout( void ); + +/*! + * @brief Function executed on Radio Rx Timeout event + */ +void OnRxTimeout( void ); + +/*! + * @brief Function executed on Radio Rx Error event + */ +void OnRxError( void ); + +/*! + * @brief Function executed on Radio Fhss Change Channel event + */ +void OnFhssChangeChannel( uint8_t channelIndex ); + +/*! + * @brief Function executed on CAD Done event + */ +void OnCadDone( void ); + +#endif // __MAIN_H__ \ No newline at end of file
--- a/mbed.bld Thu Sep 04 14:04:52 2014 +0000 +++ b/mbed.bld Fri Sep 19 14:18:37 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file
