IOTIO

Dependencies:   Nucleo_BLE_API_IOTIO Nucleo_BLE_BlueNRG Nucleo_BLE_DemoApp Nucleo_Sensor_Shield mbed

Dependents:   Nucleo_BLE_Demo_IOTIO

Fork of Nucleo_BLE_Demo by Cortex Challenge Team

Committer:
16038618
Date:
Sat Oct 29 15:11:28 2016 +0000
Revision:
1:4bdfa7d7e8bf
IOTIO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
16038618 1:4bdfa7d7e8bf 1 /* mbed Microcontroller Library
16038618 1:4bdfa7d7e8bf 2 * Copyright (c) 2006-2013 ARM Limited
16038618 1:4bdfa7d7e8bf 3 *
16038618 1:4bdfa7d7e8bf 4 * Licensed under the Apache License, Version 2.0 (the "License");
16038618 1:4bdfa7d7e8bf 5 * you may not use this file except in compliance with the License.
16038618 1:4bdfa7d7e8bf 6 * You may obtain a copy of the License at
16038618 1:4bdfa7d7e8bf 7 *
16038618 1:4bdfa7d7e8bf 8 * http://www.apache.org/licenses/LICENSE-2.0
16038618 1:4bdfa7d7e8bf 9 *
16038618 1:4bdfa7d7e8bf 10 * Unless required by applicable law or agreed to in writing, software
16038618 1:4bdfa7d7e8bf 11 * distributed under the License is distributed on an "AS IS" BASIS,
16038618 1:4bdfa7d7e8bf 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16038618 1:4bdfa7d7e8bf 13 * See the License for the specific language governing permissions and
16038618 1:4bdfa7d7e8bf 14 * limitations under the License.
16038618 1:4bdfa7d7e8bf 15 */
16038618 1:4bdfa7d7e8bf 16 #ifndef MBED_INTERFACE_H
16038618 1:4bdfa7d7e8bf 17 #define MBED_INTERFACE_H
16038618 1:4bdfa7d7e8bf 18
16038618 1:4bdfa7d7e8bf 19 #include "device.h"
16038618 1:4bdfa7d7e8bf 20
16038618 1:4bdfa7d7e8bf 21 /* Mbed interface mac address
16038618 1:4bdfa7d7e8bf 22 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
16038618 1:4bdfa7d7e8bf 23 * otherwise MAC_ADD_x are used.
16038618 1:4bdfa7d7e8bf 24 */
16038618 1:4bdfa7d7e8bf 25 #define MBED_MAC_ADDR_INTERFACE 0x00
16038618 1:4bdfa7d7e8bf 26 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 27 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 28 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 29 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 30 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 31 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
16038618 1:4bdfa7d7e8bf 32 #define MBED_MAC_ADDRESS_SUM (MBED_MAC_ADDR_0 | MBED_MAC_ADDR_1 | MBED_MAC_ADDR_2 | MBED_MAC_ADDR_3 | MBED_MAC_ADDR_4 | MBED_MAC_ADDR_5)
16038618 1:4bdfa7d7e8bf 33
16038618 1:4bdfa7d7e8bf 34 #ifdef __cplusplus
16038618 1:4bdfa7d7e8bf 35 extern "C" {
16038618 1:4bdfa7d7e8bf 36 #endif
16038618 1:4bdfa7d7e8bf 37
16038618 1:4bdfa7d7e8bf 38 #if DEVICE_SEMIHOST
16038618 1:4bdfa7d7e8bf 39
16038618 1:4bdfa7d7e8bf 40 /** Functions to control the mbed interface
16038618 1:4bdfa7d7e8bf 41 *
16038618 1:4bdfa7d7e8bf 42 * mbed Microcontrollers have a built-in interface to provide functionality such as
16038618 1:4bdfa7d7e8bf 43 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
16038618 1:4bdfa7d7e8bf 44 * system. These functions provide means to control the interface suing semihost
16038618 1:4bdfa7d7e8bf 45 * calls it supports.
16038618 1:4bdfa7d7e8bf 46 */
16038618 1:4bdfa7d7e8bf 47
16038618 1:4bdfa7d7e8bf 48 /** Determine whether the mbed interface is connected, based on whether debug is enabled
16038618 1:4bdfa7d7e8bf 49 *
16038618 1:4bdfa7d7e8bf 50 * @returns
16038618 1:4bdfa7d7e8bf 51 * 1 if interface is connected,
16038618 1:4bdfa7d7e8bf 52 * 0 otherwise
16038618 1:4bdfa7d7e8bf 53 */
16038618 1:4bdfa7d7e8bf 54 int mbed_interface_connected(void);
16038618 1:4bdfa7d7e8bf 55
16038618 1:4bdfa7d7e8bf 56 /** Instruct the mbed interface to reset, as if the reset button had been pressed
16038618 1:4bdfa7d7e8bf 57 *
16038618 1:4bdfa7d7e8bf 58 * @returns
16038618 1:4bdfa7d7e8bf 59 * 1 if successful,
16038618 1:4bdfa7d7e8bf 60 * 0 otherwise (e.g. interface not present)
16038618 1:4bdfa7d7e8bf 61 */
16038618 1:4bdfa7d7e8bf 62 int mbed_interface_reset(void);
16038618 1:4bdfa7d7e8bf 63
16038618 1:4bdfa7d7e8bf 64 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
16038618 1:4bdfa7d7e8bf 65 * The interface will still support the USB serial aspect
16038618 1:4bdfa7d7e8bf 66 *
16038618 1:4bdfa7d7e8bf 67 * @returns
16038618 1:4bdfa7d7e8bf 68 * 0 if successful,
16038618 1:4bdfa7d7e8bf 69 * -1 otherwise (e.g. interface not present)
16038618 1:4bdfa7d7e8bf 70 */
16038618 1:4bdfa7d7e8bf 71 int mbed_interface_disconnect(void);
16038618 1:4bdfa7d7e8bf 72
16038618 1:4bdfa7d7e8bf 73 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
16038618 1:4bdfa7d7e8bf 74 * connected, also power down the interface. If the USB cable is connected, the interface
16038618 1:4bdfa7d7e8bf 75 * will remain powered up and visible to the host
16038618 1:4bdfa7d7e8bf 76 *
16038618 1:4bdfa7d7e8bf 77 * @returns
16038618 1:4bdfa7d7e8bf 78 * 0 if successful,
16038618 1:4bdfa7d7e8bf 79 * -1 otherwise (e.g. interface not present)
16038618 1:4bdfa7d7e8bf 80 */
16038618 1:4bdfa7d7e8bf 81 int mbed_interface_powerdown(void);
16038618 1:4bdfa7d7e8bf 82
16038618 1:4bdfa7d7e8bf 83 /** This returns a string containing the 32-character UID of the mbed interface
16038618 1:4bdfa7d7e8bf 84 * This is a weak function that can be overwritten if required
16038618 1:4bdfa7d7e8bf 85 *
16038618 1:4bdfa7d7e8bf 86 * @param uid A 33-byte array to write the null terminated 32-byte string
16038618 1:4bdfa7d7e8bf 87 *
16038618 1:4bdfa7d7e8bf 88 * @returns
16038618 1:4bdfa7d7e8bf 89 * 0 if successful,
16038618 1:4bdfa7d7e8bf 90 * -1 otherwise (e.g. interface not present)
16038618 1:4bdfa7d7e8bf 91 */
16038618 1:4bdfa7d7e8bf 92 int mbed_interface_uid(char *uid);
16038618 1:4bdfa7d7e8bf 93
16038618 1:4bdfa7d7e8bf 94 #endif
16038618 1:4bdfa7d7e8bf 95
16038618 1:4bdfa7d7e8bf 96 /** This returns a unique 6-byte MAC address, based on the interface UID
16038618 1:4bdfa7d7e8bf 97 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
16038618 1:4bdfa7d7e8bf 98 *
16038618 1:4bdfa7d7e8bf 99 * This is a weak function that can be overwritten if you want to provide your own mechanism to
16038618 1:4bdfa7d7e8bf 100 * provide a MAC address.
16038618 1:4bdfa7d7e8bf 101 *
16038618 1:4bdfa7d7e8bf 102 * @param mac A 6-byte array to write the MAC address
16038618 1:4bdfa7d7e8bf 103 */
16038618 1:4bdfa7d7e8bf 104 void mbed_mac_address(char *mac);
16038618 1:4bdfa7d7e8bf 105
16038618 1:4bdfa7d7e8bf 106 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
16038618 1:4bdfa7d7e8bf 107 */
16038618 1:4bdfa7d7e8bf 108 void mbed_die(void);
16038618 1:4bdfa7d7e8bf 109
16038618 1:4bdfa7d7e8bf 110 #ifdef __cplusplus
16038618 1:4bdfa7d7e8bf 111 }
16038618 1:4bdfa7d7e8bf 112 #endif
16038618 1:4bdfa7d7e8bf 113
16038618 1:4bdfa7d7e8bf 114 #endif