BA / Mbed OS BaBoRo1
Committer:
borlanic
Date:
Thu Mar 29 07:02:09 2018 +0000
Revision:
0:380207fcb5c1
Encoder, IMU --> OK; Controller --> in bearbeitung

Who changed what in which revision?

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