void app_start(int, char **)
{
    // set the baud rate for output printing
	get_stdio_serial().baud(YOTTA_CFG_K64F_BORDER_ROUTER_BAUD);

    // set heap size and memory error handler for this application
    ns_dyn_mem_init(app_stack_heap, APP_DEFINED_HEAP_SIZE, app_heap_error_handler, 0);

    trace_init(); // set up the tracing library
    set_trace_print_function(trace_printer);
    set_trace_config(TRACE_MODE_COLOR | TRACE_ACTIVE_LEVEL_DEBUG | TRACE_CARRIAGE_RETURN);

    const char *mac_src = STR(YOTTA_CFG_K64F_BORDER_ROUTER_BACKHAUL_MAC_SRC);

    if (strcmp(mac_src, "BOARD") == 0) {
        /* Setting the MAC Address from UID (A yotta function)
         * Takes UID Mid low and UID low and shuffles them around. */
        mbed_mac_address((char *)mac);
    } else if (strcmp(mac_src, "CONFIG") == 0) {
        /* MAC is defined by the user through yotta configuration */
        const uint8_t mac48[] = YOTTA_CFG_K64F_BORDER_ROUTER_BACKHAUL_MAC;

        for (uint32_t i = 0; i < sizeof(mac); ++i) {
            mac[i] = mac48[i];
        }
    }

    // run LED toggler in the Minar scheduler
    minar::Scheduler::postCallback(mbed::util::FunctionPointer0<void>
                                   (toggle_led1).bind()).period(minar::milliseconds(500));

    tr_info("Starting K64F border router...");
    border_router_start();
}
Esempio n. 2
0
void app_start(int, char*[]) {
    /* Use 115200 bps for consistency with other examples */
    get_stdio_serial().baud(115200);
    minar::Scheduler::postCallback(mbed::util::FunctionPointer0<void>(run).bind());
}
/**
 * \brief Prints string to serial (adds CRLF).
 */
static void trace_printer(const char *str)
{
	get_stdio_serial().printf("%s\r\n", str);
}
Esempio n. 4
0
#define MY_FIRMWARE_VERSION		"1.0.1"
#define MY_HARDWARE_VERSION		"1.0.2"
#define MY_SOFTWARE_VERSION		"1.0.3"

// Passphrase to supply for data management authentication
#define MY_DM_PASSPHRASE		"arm1234"

// Include security.h
#include "security.h"

// mbed Endpoint Network
#include "mbed-connector-interface/mbedEndpointNetwork.h"

// Logger
#include "mbed-connector-interface/Logger.h"
static Serial &pc = get_stdio_serial();
Logger logger(&pc);

// Include the default Device Management Responders
#include "dm-responders/ResponderFunctions.h"

// Our Device Management Authenticator (trivial passphrase authenticator used)
#include "mbed-connector-interface/PassphraseAuthenticator.h"
PassphraseAuthenticator authenticator(&logger,MY_DM_PASSPHRASE);

// Our Device Management Responder
#include "mbed-connector-interface/DeviceManagementResponder.h"
DeviceManagementResponder dm_processor(&logger,&authenticator);

// Our Device Manager
#include "mbed-connector-interface/DeviceManager.h"