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