mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
emilmont
Date:
Fri Jun 14 17:49:17 2013 +0100
Revision:
10:3bc89ef62ce7
Parent:
9:0ce32e54c9a7
Child:
13:0645d8841f51
Unify mbed library sources

Who changed what in which revision?

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