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