test

Dependents:   robotic_fish_7

Committer:
juansal12
Date:
Tue Jan 14 19:14:29 2020 +0000
Revision:
0:44931ff4a3ed
Sofi 7 code;

Who changed what in which revision?

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