test

Dependents:   robotic_fish_6

Committer:
juansal12
Date:
Fri Dec 03 23:00:34 2021 +0000
Revision:
0:c792b17d9f78
uploaded sofi code ;

Who changed what in which revision?

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