mbed libraries for KL25Z
BusIn.h@8:c14af7958ef5, 2012-11-09 (annotated)
- Committer:
- emilmont
- Date:
- Fri Nov 09 11:33:53 2012 +0000
- Revision:
- 8:c14af7958ef5
- Parent:
- 0:8024c367e29f
- Child:
- 9:663789d7729f
SPI driver; ADC driver; DAC driver; microlib support; general bugfixing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 0:8024c367e29f | 1 | /* mbed Microcontroller Library - DigitalIn |
emilmont | 0:8024c367e29f | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
emilmont | 0:8024c367e29f | 3 | */ |
emilmont | 0:8024c367e29f | 4 | #ifndef MBED_BUSIN_H |
emilmont | 0:8024c367e29f | 5 | #define MBED_BUSIN_H |
emilmont | 0:8024c367e29f | 6 | |
emilmont | 0:8024c367e29f | 7 | #include "platform.h" |
emilmont | 0:8024c367e29f | 8 | #include "DigitalIn.h" |
emilmont | 0:8024c367e29f | 9 | |
emilmont | 0:8024c367e29f | 10 | namespace mbed { |
emilmont | 0:8024c367e29f | 11 | |
emilmont | 8:c14af7958ef5 | 12 | /** A digital input bus, used for reading the state of a collection of pins |
emilmont | 0:8024c367e29f | 13 | */ |
emilmont | 8:c14af7958ef5 | 14 | class BusIn { |
emilmont | 0:8024c367e29f | 15 | |
emilmont | 0:8024c367e29f | 16 | public: |
emilmont | 0:8024c367e29f | 17 | /* Group: Configuration Methods */ |
emilmont | 0:8024c367e29f | 18 | |
emilmont | 8:c14af7958ef5 | 19 | /** Create an BusIn, connected to the specified pins |
emilmont | 0:8024c367e29f | 20 | * |
emilmont | 8:c14af7958ef5 | 21 | * @param <n> DigitalIn pin to connect to bus bit <n> (p5-p30, NC) |
emilmont | 0:8024c367e29f | 22 | * |
emilmont | 8:c14af7958ef5 | 23 | * @note |
emilmont | 0:8024c367e29f | 24 | * It is only required to specify as many pin variables as is required |
emilmont | 0:8024c367e29f | 25 | * for the bus; the rest will default to NC (not connected) |
emilmont | 0:8024c367e29f | 26 | */ |
emilmont | 0:8024c367e29f | 27 | BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
emilmont | 0:8024c367e29f | 28 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
emilmont | 0:8024c367e29f | 29 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
emilmont | 8:c14af7958ef5 | 30 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC); |
emilmont | 0:8024c367e29f | 31 | |
emilmont | 8:c14af7958ef5 | 32 | BusIn(PinName pins[16]); |
emilmont | 8:c14af7958ef5 | 33 | |
emilmont | 0:8024c367e29f | 34 | virtual ~BusIn(); |
emilmont | 0:8024c367e29f | 35 | |
emilmont | 8:c14af7958ef5 | 36 | /** Read the value of the input bus |
emilmont | 0:8024c367e29f | 37 | * |
emilmont | 8:c14af7958ef5 | 38 | * @returns |
emilmont | 8:c14af7958ef5 | 39 | * An integer with each bit corresponding to the value read from the associated DigitalIn pin |
emilmont | 0:8024c367e29f | 40 | */ |
emilmont | 0:8024c367e29f | 41 | int read(); |
emilmont | 0:8024c367e29f | 42 | |
emilmont | 0:8024c367e29f | 43 | #ifdef MBED_OPERATORS |
emilmont | 8:c14af7958ef5 | 44 | /** A shorthand for read() |
emilmont | 0:8024c367e29f | 45 | */ |
emilmont | 0:8024c367e29f | 46 | operator int(); |
emilmont | 0:8024c367e29f | 47 | #endif |
emilmont | 0:8024c367e29f | 48 | |
emilmont | 0:8024c367e29f | 49 | protected: |
emilmont | 0:8024c367e29f | 50 | DigitalIn* _pin[16]; |
emilmont | 0:8024c367e29f | 51 | }; |
emilmont | 0:8024c367e29f | 52 | |
emilmont | 0:8024c367e29f | 53 | } // namespace mbed |
emilmont | 0:8024c367e29f | 54 | |
emilmont | 0:8024c367e29f | 55 | #endif |