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