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