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