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