]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/api/mbed_interface.h
1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef MBED_INTERFACE_H
17 #define MBED_INTERFACE_H
21 /* Mbed interface mac address
22 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
23 * otherwise MAC_ADD_x are used.
25 #define MBED_MAC_ADDR_INTERFACE 0x00
26 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
27 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
28 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
29 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
30 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
31 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
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)
40 /** Functions to control the mbed interface
42 * mbed Microcontrollers have a built-in interface to provide functionality such as
43 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
44 * system. These functions provide means to control the interface suing semihost
48 /** Determine whether the mbed interface is connected, based on whether debug is enabled
51 * 1 if interface is connected,
54 int mbed_interface_connected(void);
56 /** Instruct the mbed interface to reset, as if the reset button had been pressed
60 * 0 otherwise (e.g. interface not present)
62 int mbed_interface_reset(void);
64 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
65 * The interface will still support the USB serial aspect
69 * -1 otherwise (e.g. interface not present)
71 int mbed_interface_disconnect(void);
73 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
74 * connected, also power down the interface. If the USB cable is connected, the interface
75 * will remain powered up and visible to the host
79 * -1 otherwise (e.g. interface not present)
81 int mbed_interface_powerdown(void);
83 /** This returns a string containing the 32-character UID of the mbed interface
84 * This is a weak function that can be overwritten if required
86 * @param uid A 33-byte array to write the null terminated 32-byte string
90 * -1 otherwise (e.g. interface not present)
92 int mbed_interface_uid(char *uid
);
96 /** This returns a unique 6-byte MAC address, based on the interface UID
97 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
99 * This is a weak function that can be overwritten if you want to provide your own mechanism to
100 * provide a MAC address.
102 * @param mac A 6-byte array to write the MAC address
104 void mbed_mac_address(char *mac
);
106 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence