1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "DigitalIn.h"
24 /** A digital input bus, used for reading the state of a collection of pins
29 /* Group: Configuration Methods */
31 /** Create an BusIn, connected to the specified pins
33 * @param <n> DigitalIn pin to connect to bus bit <n> (p5-p30, NC)
36 * It is only required to specify as many pin variables as is required
37 * for the bus; the rest will default to NC (not connected)
39 BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
40 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
41 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
42 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
44 BusIn(PinName pins[16]);
48 /** Read the value of the input bus
51 * An integer with each bit corresponding to the value read from the associated DigitalIn pin
55 /** Set the input pin mode
57 * @param mode PullUp, PullDown, PullNone
59 void mode(PinMode pull);
61 /** Binary mask of bus pins connected to actual pins (not NC pins)
62 * If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
65 * Binary mask of connected pins
72 /** A shorthand for read()
76 /** Access to particular bit in random-iterator fashion
78 DigitalIn & operator[] (int index);
84 /** Mask of bus's NC pins
85 * If bit[n] is set to 1 - pin is connected
86 * if bit[n] is cleared - pin is not connected (NC)
90 /* disallow copy constructor and assignment operators */
93 BusIn & operator = (const BusIn&);