customized mbed library sources for nrf51822

Dependents:   Grove_Node Potentiometer BLE_Beacon I2C_Scanner

Committer:
yihui
Date:
Tue Nov 04 07:38:53 2014 +0000
Revision:
0:700cadd8b708
customized mbed-src library for nrf51822

Who changed what in which revision?

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