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

Committer:
sam_grove
Date:
Thu Mar 05 15:47:08 2015 +0000
Revision:
2:3e7685cfb2a7
Updating to techcon demo program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 2:3e7685cfb2a7 1 #include "mbed.h"
sam_grove 2:3e7685cfb2a7 2 #include "arm_hal_timer.h"
sam_grove 2:3e7685cfb2a7 3
sam_grove 2:3e7685cfb2a7 4 static void (*sn_callback)(void) = NULL;
sam_grove 2:3e7685cfb2a7 5 static Ticker sn_timer;
sam_grove 2:3e7685cfb2a7 6 //static uint32_t sn_compare_value;
sam_grove 2:3e7685cfb2a7 7 static timestamp_t sn_compare_value;
sam_grove 2:3e7685cfb2a7 8 static bool timer_enabled = false;
sam_grove 2:3e7685cfb2a7 9
sam_grove 2:3e7685cfb2a7 10 #define MAXIMUM_SLOTS 10000
sam_grove 2:3e7685cfb2a7 11
sam_grove 2:3e7685cfb2a7 12 extern "C" void arm_timer_init(void)
sam_grove 2:3e7685cfb2a7 13 {
sam_grove 2:3e7685cfb2a7 14 //init in Ticker ctor
sam_grove 2:3e7685cfb2a7 15 }
sam_grove 2:3e7685cfb2a7 16
sam_grove 2:3e7685cfb2a7 17 extern "C" void arm_timer_set_cb(void (*callback)(void))
sam_grove 2:3e7685cfb2a7 18 {
sam_grove 2:3e7685cfb2a7 19 sn_callback = callback;
sam_grove 2:3e7685cfb2a7 20 }
sam_grove 2:3e7685cfb2a7 21
sam_grove 2:3e7685cfb2a7 22 extern "C" void arm_timer_start(uint16_t slots)
sam_grove 2:3e7685cfb2a7 23 {
sam_grove 2:3e7685cfb2a7 24 sn_compare_value = slots * 50; // 1 slot = 50us
sam_grove 2:3e7685cfb2a7 25 sn_timer.attach_us(sn_callback, sn_compare_value);
sam_grove 2:3e7685cfb2a7 26 timer_enabled = true;
sam_grove 2:3e7685cfb2a7 27 }
sam_grove 2:3e7685cfb2a7 28
sam_grove 2:3e7685cfb2a7 29 extern "C" void arm_timer_stop(void)
sam_grove 2:3e7685cfb2a7 30 {
sam_grove 2:3e7685cfb2a7 31 sn_timer.detach();
sam_grove 2:3e7685cfb2a7 32 timer_enabled = false;
sam_grove 2:3e7685cfb2a7 33 }
sam_grove 2:3e7685cfb2a7 34
sam_grove 2:3e7685cfb2a7 35 extern "C" uint16_t arm_timer_get_remaining_slots(void)
sam_grove 2:3e7685cfb2a7 36 {
sam_grove 2:3e7685cfb2a7 37 uint32_t counter = us_ticker_read();
sam_grove 2:3e7685cfb2a7 38 uint32_t slots = ((sn_compare_value - counter) / 50);
sam_grove 2:3e7685cfb2a7 39
sam_grove 2:3e7685cfb2a7 40 if ((slots > MAXIMUM_SLOTS) || (timer_enabled == false)) {
sam_grove 2:3e7685cfb2a7 41 slots = 0;
sam_grove 2:3e7685cfb2a7 42 }
sam_grove 2:3e7685cfb2a7 43
sam_grove 2:3e7685cfb2a7 44 return (uint16_t)slots;
sam_grove 2:3e7685cfb2a7 45 }