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: C12832_lcd DigiLogger LM75B XBeeLib2 mbed
Fork of XBee802_Send_Data by
Revision 0:a8cde1e2de5b, committed 2015-04-29
- Comitter:
- hbujanda
- Date:
- Wed Apr 29 17:58:22 2015 +0200
- Child:
- 1:df31db204364
- Commit message:
- Automatic upload
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/XBeeLib.lib Wed Apr 29 17:58:22 2015 +0200 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/Digi-International-Inc/code/XBeeLib/#7bfa82960634
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.h Wed Apr 29 17:58:22 2015 +0200 @@ -0,0 +1,55 @@ + +#if !defined(__CONFIG_H_) +#define __CONFIG_H_ + +//#define PATFORM_ARCHPRO + +/** Library configuration options */ +#define ENABLE_LOGGING +#define ENABLE_ASSERTIONS +#define FRAME_BUFFER_SIZE 4 +#define MAX_FRAME_PAYLOAD_LEN 128 +#define ENABLE_PM_SUPPORT + +#define SYNC_OPS_TIMEOUT_MS 2000 +#define REM_SYNC_OPS_TIMEOUT_MS 3000 + +#if defined(PATFORM_ARCHPRO) +#define RADIO_TX P4_28 +#define RADIO_RX P4_29 +#define RADIO_RESET NC +//#define RADIO_RESET NC +#define RADIO_SLEEP_REQ NC +#define RADIO_ON_SLEEP NC +#define DEBUG_TX P0_2 +#define DEBUG_RX P0_3 +#elif defined(TARGET_LPC1768) +#define RADIO_TX p9 +#define RADIO_RX p10 +#define RADIO_RESET p30 +#define RADIO_SLEEP_REQ NC +#define RADIO_ON_SLEEP NC +#define DEBUG_TX P0_2 +#define DEBUG_RX P0_3 +#elif defined(TARGET_FRDM_KL25) +#define RADIO_TX PTD3 +#define RADIO_RX PTD2 +#define RADIO_RESET NC +#define RADIO_SLEEP_REQ NC +#define RADIO_ON_SLEEP NC +#define DEBUG_TX USBTX +#define DEBUG_RX USBRX +#elif (defined TARGET_LPC11U24) +#define RADIO_TX p9 +#define RADIO_RX p10 +#define RADIO_RESET p30 +#define RADIO_SLEEP_REQ NC +#define RADIO_ON_SLEEP NC +#define DEBUG_TX USBTX +#define DEBUG_RX USBRX +#else +#error "Define a platform" +#endif + +#endif /* __CONFIG_H_ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Apr 29 17:58:22 2015 +0200
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2015 Digi International Inc.,
+ * All rights not expressly granted are reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
+ * =======================================================================
+ */
+
+#include "mbed.h"
+#include "XBeeLib.h"
+#if defined(ENABLE_LOGGING)
+#include "DigiLoggerMbedSerial.h"
+using namespace DigiLog;
+#endif
+
+// TODO Replace with the MSB of the remote module's 64-bit address (SH parameter)
+#define REMOTE_NODE_ADDR64_MSB ((uint32_t)0x0013A200)
+// TODO Replace with the LSB of the remote module's 64-bit address (SL parameter)
+#define REMOTE_NODE_ADDR64_LSB ((uint32_t)0x40D2B03E)
+// TODO Replace with the remote module's 16-bit address (MY parameter)
+#define REMOTE_NODE_ADDR16 ((uint16_t)0x1111)
+
+using namespace XBeeLib;
+
+Serial *log_serial;
+
+static void send_broadcast_data(XBee802& xbee)
+{
+ const char data[] = "send_broadcast_data";
+ const uint16_t data_len = strlen(data);
+
+ const TxStatus txStatus = xbee.send_data_broadcast((const uint8_t *)data, data_len);
+
+ if (txStatus == TxStatusSuccess)
+ log_serial->printf("send_broadcast_data OK\r\n");
+ else
+ log_serial->printf("send_broadcast_data failed with %d\r\n", (int) txStatus);
+}
+
+static void send_data_to_remote_node(XBee802& xbee, const RemoteXBee802& RemoteDevice)
+{
+ const char data[] = "send_data_to_remote_node";
+ const uint16_t data_len = strlen(data);
+
+ const TxStatus txStatus = xbee.send_data(RemoteDevice, (const uint8_t *)data, data_len);
+
+ if (txStatus == TxStatusSuccess)
+ log_serial->printf("send_data_to_remote_node OK\r\n");
+ else
+ log_serial->printf("send_data_to_remote_node failed with %d\r\n", (int) txStatus);
+}
+
+int main()
+{
+ log_serial = new Serial(DEBUG_TX, DEBUG_RX);
+ log_serial->baud(9600);
+ log_serial->printf("Sample application to demo how to send unicast and broadcast data with the XBee802\r\n\r\n");
+ log_serial->printf(XB_LIB_BANNER);
+
+#if defined(ENABLE_LOGGING)
+ new DigiLoggerMbedSerial(log_serial, LogLevelInfo);
+#endif
+
+ XBee802 xbee = XBee802(RADIO_TX, RADIO_RX, RADIO_RESET, NC, NC, 9600);
+
+ RadioStatus radioStatus = xbee.init();
+ MBED_ASSERT(radioStatus == Success);
+
+ const RemoteXBee802 remoteDevice64b = RemoteXBee802(Addr64(REMOTE_NODE_ADDR64_MSB, REMOTE_NODE_ADDR64_LSB));
+ const RemoteXBee802 remoteDevice16b = RemoteXBee802(REMOTE_NODE_ADDR16);
+
+ send_broadcast_data(xbee);
+ send_data_to_remote_node(xbee, remoteDevice64b);
+ send_data_to_remote_node(xbee, remoteDevice16b);
+
+ delete(log_serial);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Apr 29 17:58:22 2015 +0200 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file
