Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

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