FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.

Dependencies:   mbed FXOS8700CQ MODSERIAL

Committer:
jwhammel
Date:
Mon Apr 29 04:24:38 2019 +0000
Revision:
85:0cf65ceb4492
Parent:
84:fc8c9b39723a
We have added an alarm trigger that gets sent to AT&T Flow.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jwhammel 84:fc8c9b39723a 1 /* mbed Microcontroller Library
jwhammel 84:fc8c9b39723a 2 * Copyright (c) 2006-2013 ARM Limited
jwhammel 84:fc8c9b39723a 3 *
jwhammel 84:fc8c9b39723a 4 * Licensed under the Apache License, Version 2.0 (the "License");
jwhammel 84:fc8c9b39723a 5 * you may not use this file except in compliance with the License.
jwhammel 84:fc8c9b39723a 6 * You may obtain a copy of the License at
jwhammel 84:fc8c9b39723a 7 *
jwhammel 84:fc8c9b39723a 8 * http://www.apache.org/licenses/LICENSE-2.0
jwhammel 84:fc8c9b39723a 9 *
jwhammel 84:fc8c9b39723a 10 * Unless required by applicable law or agreed to in writing, software
jwhammel 84:fc8c9b39723a 11 * distributed under the License is distributed on an "AS IS" BASIS,
jwhammel 84:fc8c9b39723a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jwhammel 84:fc8c9b39723a 13 * See the License for the specific language governing permissions and
jwhammel 84:fc8c9b39723a 14 * limitations under the License.
jwhammel 84:fc8c9b39723a 15 */
jwhammel 84:fc8c9b39723a 16 #ifndef MBED_BUSINOUT_H
jwhammel 84:fc8c9b39723a 17 #define MBED_BUSINOUT_H
jwhammel 84:fc8c9b39723a 18
jwhammel 84:fc8c9b39723a 19 #include "DigitalInOut.h"
jwhammel 84:fc8c9b39723a 20
jwhammel 84:fc8c9b39723a 21 namespace mbed {
jwhammel 84:fc8c9b39723a 22
jwhammel 84:fc8c9b39723a 23 /** A digital input output bus, used for setting the state of a collection of pins
jwhammel 84:fc8c9b39723a 24 */
jwhammel 84:fc8c9b39723a 25 class BusInOut {
jwhammel 84:fc8c9b39723a 26
jwhammel 84:fc8c9b39723a 27 public:
jwhammel 84:fc8c9b39723a 28
jwhammel 84:fc8c9b39723a 29 /** Create an BusInOut, connected to the specified pins
jwhammel 84:fc8c9b39723a 30 *
jwhammel 84:fc8c9b39723a 31 * @param p<n> DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
jwhammel 84:fc8c9b39723a 32 *
jwhammel 84:fc8c9b39723a 33 * @note
jwhammel 84:fc8c9b39723a 34 * It is only required to specify as many pin variables as is required
jwhammel 84:fc8c9b39723a 35 * for the bus; the rest will default to NC (not connected)
jwhammel 84:fc8c9b39723a 36 */
jwhammel 84:fc8c9b39723a 37 BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
jwhammel 84:fc8c9b39723a 38 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
jwhammel 84:fc8c9b39723a 39 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
jwhammel 84:fc8c9b39723a 40 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
jwhammel 84:fc8c9b39723a 41
jwhammel 84:fc8c9b39723a 42 BusInOut(PinName pins[16]);
jwhammel 84:fc8c9b39723a 43
jwhammel 84:fc8c9b39723a 44 virtual ~BusInOut();
jwhammel 84:fc8c9b39723a 45
jwhammel 84:fc8c9b39723a 46 /* Group: Access Methods */
jwhammel 84:fc8c9b39723a 47
jwhammel 84:fc8c9b39723a 48 /** Write the value to the output bus
jwhammel 84:fc8c9b39723a 49 *
jwhammel 84:fc8c9b39723a 50 * @param value An integer specifying a bit to write for every corresponding DigitalInOut pin
jwhammel 84:fc8c9b39723a 51 */
jwhammel 84:fc8c9b39723a 52 void write(int value);
jwhammel 84:fc8c9b39723a 53
jwhammel 84:fc8c9b39723a 54
jwhammel 84:fc8c9b39723a 55 /** Read the value currently output on the bus
jwhammel 84:fc8c9b39723a 56 *
jwhammel 84:fc8c9b39723a 57 * @returns
jwhammel 84:fc8c9b39723a 58 * An integer with each bit corresponding to associated DigitalInOut pin setting
jwhammel 84:fc8c9b39723a 59 */
jwhammel 84:fc8c9b39723a 60 int read();
jwhammel 84:fc8c9b39723a 61
jwhammel 84:fc8c9b39723a 62 /** Set as an output
jwhammel 84:fc8c9b39723a 63 */
jwhammel 84:fc8c9b39723a 64 void output();
jwhammel 84:fc8c9b39723a 65
jwhammel 84:fc8c9b39723a 66 /** Set as an input
jwhammel 84:fc8c9b39723a 67 */
jwhammel 84:fc8c9b39723a 68 void input();
jwhammel 84:fc8c9b39723a 69
jwhammel 84:fc8c9b39723a 70 /** Set the input pin mode
jwhammel 84:fc8c9b39723a 71 *
jwhammel 84:fc8c9b39723a 72 * @param mode PullUp, PullDown, PullNone
jwhammel 84:fc8c9b39723a 73 */
jwhammel 84:fc8c9b39723a 74 void mode(PinMode pull);
jwhammel 84:fc8c9b39723a 75
jwhammel 84:fc8c9b39723a 76 #ifdef MBED_OPERATORS
jwhammel 84:fc8c9b39723a 77 /** A shorthand for write()
jwhammel 84:fc8c9b39723a 78 */
jwhammel 84:fc8c9b39723a 79 BusInOut& operator= (int v);
jwhammel 84:fc8c9b39723a 80 BusInOut& operator= (BusInOut& rhs);
jwhammel 84:fc8c9b39723a 81
jwhammel 84:fc8c9b39723a 82 /** A shorthand for read()
jwhammel 84:fc8c9b39723a 83 */
jwhammel 84:fc8c9b39723a 84 operator int();
jwhammel 84:fc8c9b39723a 85 #endif
jwhammel 84:fc8c9b39723a 86
jwhammel 84:fc8c9b39723a 87 protected:
jwhammel 84:fc8c9b39723a 88 DigitalInOut* _pin[16];
jwhammel 84:fc8c9b39723a 89
jwhammel 84:fc8c9b39723a 90 /* disallow copy constructor and assignment operators */
jwhammel 84:fc8c9b39723a 91 private:
jwhammel 84:fc8c9b39723a 92 BusInOut(const BusInOut&);
jwhammel 84:fc8c9b39723a 93 BusInOut & operator = (const BusInOut&);
jwhammel 84:fc8c9b39723a 94 };
jwhammel 84:fc8c9b39723a 95
jwhammel 84:fc8c9b39723a 96 } // namespace mbed
jwhammel 84:fc8c9b39723a 97
jwhammel 84:fc8c9b39723a 98 #endif
jwhammel 84:fc8c9b39723a 99