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