Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_interface.h Source File

mbed_interface.h

00001 
00002 /** \addtogroup platform */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2006-2013 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 #ifndef MBED_INTERFACE_H
00020 #define MBED_INTERFACE_H
00021 
00022 #include <stdarg.h>
00023 
00024 #include "device.h"
00025 
00026 /* Mbed interface mac address
00027  * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
00028  * otherwise MAC_ADD_x are used.
00029  */
00030 #define MBED_MAC_ADDR_INTERFACE 0x00
00031 #define MBED_MAC_ADDR_0  MBED_MAC_ADDR_INTERFACE
00032 #define MBED_MAC_ADDR_1  MBED_MAC_ADDR_INTERFACE
00033 #define MBED_MAC_ADDR_2  MBED_MAC_ADDR_INTERFACE
00034 #define MBED_MAC_ADDR_3  MBED_MAC_ADDR_INTERFACE
00035 #define MBED_MAC_ADDR_4  MBED_MAC_ADDR_INTERFACE
00036 #define MBED_MAC_ADDR_5  MBED_MAC_ADDR_INTERFACE
00037 #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)
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 #if DEVICE_SEMIHOST
00044 
00045 /** Functions to control the mbed interface
00046  *
00047  * mbed Microcontrollers have a built-in interface to provide functionality such as
00048  * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
00049  * system. These functions provide means to control the interface suing semihost
00050  * calls it supports.
00051  */
00052 
00053 /** Determine whether the mbed interface is connected, based on whether debug is enabled
00054  *
00055  *  @returns
00056  *    1 if interface is connected,
00057  *    0 otherwise
00058  */
00059 int mbed_interface_connected(void);
00060 
00061 /** Instruct the mbed interface to reset, as if the reset button had been pressed
00062  *
00063  *  @returns
00064  *    1 if successful,
00065  *    0 otherwise (e.g. interface not present)
00066  */
00067 int mbed_interface_reset(void);
00068 
00069 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
00070  * The interface will still support the USB serial aspect
00071  *
00072  *  @returns
00073  *    0 if successful,
00074  *   -1 otherwise (e.g. interface not present)
00075  */
00076 int mbed_interface_disconnect(void);
00077 
00078 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
00079  * connected, also power down the interface. If the USB cable is connected, the interface
00080  * will remain powered up and visible to the host
00081  *
00082  *  @returns
00083  *    0 if successful,
00084  *   -1 otherwise (e.g. interface not present)
00085  */
00086 int mbed_interface_powerdown(void);
00087 
00088 /** This returns a string containing the 32-character UID of the mbed interface
00089  *  This is a weak function that can be overwritten if required
00090  *
00091  *  @param uid A 33-byte array to write the null terminated 32-byte string
00092  *
00093  *  @returns
00094  *    0 if successful,
00095  *   -1 otherwise (e.g. interface not present)
00096  */
00097 int mbed_interface_uid(char *uid);
00098 
00099 #endif
00100 
00101 /** This returns a unique 6-byte MAC address, based on the interface UID
00102  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
00103  *
00104  * This is a weak function that can be overwritten if you want to provide your own mechanism to
00105  * provide a MAC address.
00106  *
00107  *  @param mac A 6-byte array to write the MAC address
00108  */
00109 void mbed_mac_address(char *mac);
00110 
00111 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
00112  */
00113 void mbed_die(void);
00114 
00115 /** Print out an error message.  This is typically called when
00116  * hanlding a crash.
00117  *
00118  * @Note Synchronization level: Interrupt safe
00119  */
00120 void mbed_error_printf(const char* format, ...);
00121 
00122 /** Print out an error message.  Similar to mbed_error_printf
00123  * but uses a va_list.
00124  *
00125  * @Note Synchronization level: Interrupt safe
00126  */
00127 void mbed_error_vfprintf(const char * format, va_list arg);
00128 
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132 
00133 #endif
00134 
00135 /** @}*/