IoT Home Alarm System

Dependents:   IoTBurglar_and_Fire_AlarmSystem

Committer:
kbrahmbhatt6
Date:
Fri Apr 29 06:59:59 2016 +0000
Revision:
0:2f388b030837
1

Who changed what in which revision?

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