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