Lab 1 Program C
Fork of mbed by
mbed_interface.h@44:1c5f591fce58, 2015-09-29 (annotated)
- Committer:
- mattsims12
- Date:
- Tue Sep 29 03:04:58 2015 +0000
- Revision:
- 44:1c5f591fce58
- Parent:
- 43:aff670d0d510
Lab 1 Program C
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 43:aff670d0d510 | 1 | /** Functions to control the mbed interface |
emilmont | 27:7110ebee3484 | 2 | * |
emilmont | 27:7110ebee3484 | 3 | * mbed Microcontrollers have a built-in interface to provide functionality such as |
emilmont | 27:7110ebee3484 | 4 | * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file |
emilmont | 27:7110ebee3484 | 5 | * system. These functions provide means to control the interface suing semihost |
emilmont | 27:7110ebee3484 | 6 | * calls it supports. |
emilmont | 27:7110ebee3484 | 7 | */ |
emilmont | 27:7110ebee3484 | 8 | |
emilmont | 27:7110ebee3484 | 9 | /* mbed Microcontroller Library - mbed_interface |
emilmont | 27:7110ebee3484 | 10 | * Copyright (c) 2009-2011 ARM Limited. All rights reserved. |
emilmont | 27:7110ebee3484 | 11 | */ |
emilmont | 27:7110ebee3484 | 12 | |
emilmont | 27:7110ebee3484 | 13 | #ifndef MBED_INTERFACE_H |
emilmont | 27:7110ebee3484 | 14 | #define MBED_INTERFACE_H |
emilmont | 27:7110ebee3484 | 15 | |
emilmont | 27:7110ebee3484 | 16 | #ifdef __cplusplus |
emilmont | 27:7110ebee3484 | 17 | extern "C" { |
emilmont | 27:7110ebee3484 | 18 | #endif |
emilmont | 27:7110ebee3484 | 19 | |
screamer | 43:aff670d0d510 | 20 | /** Determine whether the mbed interface is connected, based on whether debug is enabled |
emilmont | 27:7110ebee3484 | 21 | * |
screamer | 43:aff670d0d510 | 22 | * @returns |
screamer | 43:aff670d0d510 | 23 | * 1 if interface is connected, |
screamer | 43:aff670d0d510 | 24 | * 0 otherwise |
emilmont | 27:7110ebee3484 | 25 | */ |
emilmont | 27:7110ebee3484 | 26 | int mbed_interface_connected(void); |
emilmont | 27:7110ebee3484 | 27 | |
screamer | 43:aff670d0d510 | 28 | /** Instruct the mbed interface to reset, as if the reset button had been pressed |
emilmont | 27:7110ebee3484 | 29 | * |
screamer | 43:aff670d0d510 | 30 | * @returns |
screamer | 43:aff670d0d510 | 31 | * 1 if successful, |
screamer | 43:aff670d0d510 | 32 | * 0 otherwise (e.g. interface not present) |
emilmont | 27:7110ebee3484 | 33 | */ |
emilmont | 27:7110ebee3484 | 34 | int mbed_interface_reset(void); |
emilmont | 27:7110ebee3484 | 35 | |
screamer | 43:aff670d0d510 | 36 | /** This will disconnect the debug aspect of the interface, so semihosting will be disabled. |
screamer | 43:aff670d0d510 | 37 | * The interface will still support the USB serial aspect |
emilmont | 27:7110ebee3484 | 38 | * |
screamer | 43:aff670d0d510 | 39 | * @returns |
screamer | 43:aff670d0d510 | 40 | * 0 if successful, |
screamer | 43:aff670d0d510 | 41 | * -1 otherwise (e.g. interface not present) |
emilmont | 27:7110ebee3484 | 42 | */ |
emilmont | 27:7110ebee3484 | 43 | int mbed_interface_disconnect(void); |
emilmont | 27:7110ebee3484 | 44 | |
screamer | 43:aff670d0d510 | 45 | /** This will disconnect the debug aspect of the interface, and if the USB cable is not |
screamer | 43:aff670d0d510 | 46 | * connected, also power down the interface. If the USB cable is connected, the interface |
screamer | 43:aff670d0d510 | 47 | * will remain powered up and visible to the host |
emilmont | 27:7110ebee3484 | 48 | * |
screamer | 43:aff670d0d510 | 49 | * @returns |
screamer | 43:aff670d0d510 | 50 | * 0 if successful, |
screamer | 43:aff670d0d510 | 51 | * -1 otherwise (e.g. interface not present) |
emilmont | 27:7110ebee3484 | 52 | */ |
emilmont | 27:7110ebee3484 | 53 | int mbed_interface_powerdown(void); |
emilmont | 27:7110ebee3484 | 54 | |
screamer | 43:aff670d0d510 | 55 | /** This returns a string containing the 32-character UID of the mbed interface |
screamer | 43:aff670d0d510 | 56 | * This is a weak function that can be overwritten if required |
emilmont | 27:7110ebee3484 | 57 | * |
screamer | 43:aff670d0d510 | 58 | * @param uid A 33-byte array to write the null terminated 32-byte string |
emilmont | 27:7110ebee3484 | 59 | * |
screamer | 43:aff670d0d510 | 60 | * @returns |
screamer | 43:aff670d0d510 | 61 | * 0 if successful, |
screamer | 43:aff670d0d510 | 62 | * -1 otherwise (e.g. interface not present) |
emilmont | 27:7110ebee3484 | 63 | */ |
emilmont | 27:7110ebee3484 | 64 | int mbed_interface_uid(char *uid); |
emilmont | 27:7110ebee3484 | 65 | |
screamer | 43:aff670d0d510 | 66 | /** This returns a unique 6-byte MAC address, based on the interface UID |
screamer | 43:aff670d0d510 | 67 | * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) |
emilmont | 27:7110ebee3484 | 68 | * |
screamer | 43:aff670d0d510 | 69 | * This is a weak function that can be overwritten if you want to provide your own mechanism to |
screamer | 43:aff670d0d510 | 70 | * provide a MAC address. |
screamer | 43:aff670d0d510 | 71 | * |
screamer | 43:aff670d0d510 | 72 | * @param mac A 6-byte array to write the MAC address |
emilmont | 27:7110ebee3484 | 73 | */ |
emilmont | 27:7110ebee3484 | 74 | void mbed_mac_address(char *mac); |
emilmont | 27:7110ebee3484 | 75 | |
screamer | 43:aff670d0d510 | 76 | /** Cause the mbed to flash the BLOD LED sequence |
emilmont | 27:7110ebee3484 | 77 | */ |
emilmont | 27:7110ebee3484 | 78 | void mbed_die(void); |
emilmont | 27:7110ebee3484 | 79 | |
emilmont | 27:7110ebee3484 | 80 | #ifdef __cplusplus |
emilmont | 27:7110ebee3484 | 81 | } |
emilmont | 27:7110ebee3484 | 82 | #endif |
emilmont | 27:7110ebee3484 | 83 | |
emilmont | 27:7110ebee3484 | 84 | #endif |