Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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