Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

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