NXP / Mbed 2 deprecated mcr20_wireless_uart

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by Freescale

By default, the application uses broadcast addresses for OTA communication. This way, the application can be directly downloaded and run without any user intervention. The following use case assumes no changes have been done to the project.

  • Two (or more) MCR20A platforms (plugged into the FRDM-K64F Freescale Freedom Development platform) have to be connected to the PC using the mini/micro-USB cables.
  • The code must be downloaded on the platforms via CMSIS-DAP (or other means).
  • After that, two or more TERM applications must be opened, and the serial ports must be configured with the same baud rate as the one in the project (default baud rate is 115200). Other necessary serial configurations are 8 bit, no parity, and 1 stop bit.
  • To start the setup, each platform must be reset, and one of the (user) push buttons found on the MCR20A platform must be pressed. The user can press any of the non-reset buttons on the FRDM-K64F Freescale Freedom Development platform as well. *This initiates the state machine of the application so user can start.

Documentation

SMAC Demo Applications User Guide

Revision:
2:3e7685cfb2a7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NanoStack_HAL/arm_timer.cpp	Thu Mar 05 15:47:08 2015 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "arm_hal_timer.h"
+
+static void (*sn_callback)(void) = NULL;
+static Ticker sn_timer;
+//static uint32_t sn_compare_value;
+static timestamp_t sn_compare_value;
+static bool timer_enabled = false;
+ 
+#define MAXIMUM_SLOTS 10000
+ 
+extern "C" void arm_timer_init(void)
+{
+    //init in Ticker ctor
+}
+ 
+extern "C" void arm_timer_set_cb(void (*callback)(void))
+{
+    sn_callback = callback;
+}
+ 
+extern "C" void arm_timer_start(uint16_t slots)
+{
+    sn_compare_value = slots * 50; // 1 slot = 50us
+    sn_timer.attach_us(sn_callback, sn_compare_value);
+    timer_enabled = true;
+}
+ 
+extern "C" void arm_timer_stop(void)
+{
+    sn_timer.detach();
+    timer_enabled = false;
+}
+ 
+extern "C" uint16_t arm_timer_get_remaining_slots(void)
+{
+    uint32_t counter = us_ticker_read();
+    uint32_t slots = ((sn_compare_value - counter) / 50);
+ 
+    if ((slots > MAXIMUM_SLOTS) || (timer_enabled == false)) {
+        slots = 0;
+    }
+
+    return (uint16_t)slots;
+}