mbed libraries for KL25Z
BusIn.h@0:8024c367e29f, 2012-10-05 (annotated)
- Committer:
- emilmont
- Date:
- Fri Oct 05 09:16:41 2012 +0000
- Revision:
- 0:8024c367e29f
- Child:
- 8:c14af7958ef5
First release of the mbed libraries for KL25Z
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 | |
emilmont | 0:8024c367e29f | 5 | #ifndef MBED_BUSIN_H |
emilmont | 0:8024c367e29f | 6 | #define MBED_BUSIN_H |
emilmont | 0:8024c367e29f | 7 | |
emilmont | 0:8024c367e29f | 8 | #include "platform.h" |
emilmont | 0:8024c367e29f | 9 | #include "PinNames.h" |
emilmont | 0:8024c367e29f | 10 | #include "PeripheralNames.h" |
emilmont | 0:8024c367e29f | 11 | #include "Base.h" |
emilmont | 0:8024c367e29f | 12 | #include "DigitalIn.h" |
emilmont | 0:8024c367e29f | 13 | |
emilmont | 0:8024c367e29f | 14 | namespace mbed { |
emilmont | 0:8024c367e29f | 15 | |
emilmont | 0:8024c367e29f | 16 | /* Class: BusIn |
emilmont | 0:8024c367e29f | 17 | * A digital input bus, used for reading the state of a collection of pins |
emilmont | 0:8024c367e29f | 18 | */ |
emilmont | 0:8024c367e29f | 19 | class BusIn : public Base { |
emilmont | 0:8024c367e29f | 20 | |
emilmont | 0:8024c367e29f | 21 | public: |
emilmont | 0:8024c367e29f | 22 | |
emilmont | 0:8024c367e29f | 23 | /* Group: Configuration Methods */ |
emilmont | 0:8024c367e29f | 24 | |
emilmont | 0:8024c367e29f | 25 | /* Constructor: BusIn |
emilmont | 0:8024c367e29f | 26 | * Create an BusIn, connected to the specified pins |
emilmont | 0:8024c367e29f | 27 | * |
emilmont | 0:8024c367e29f | 28 | * Variables: |
emilmont | 0:8024c367e29f | 29 | * p<n> - DigitalIn pin to connect to bus bit <n> (p5-p30, NC) |
emilmont | 0:8024c367e29f | 30 | * |
emilmont | 0:8024c367e29f | 31 | * Note: |
emilmont | 0:8024c367e29f | 32 | * It is only required to specify as many pin variables as is required |
emilmont | 0:8024c367e29f | 33 | * for the bus; the rest will default to NC (not connected) |
emilmont | 0:8024c367e29f | 34 | */ |
emilmont | 0:8024c367e29f | 35 | BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
emilmont | 0:8024c367e29f | 36 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
emilmont | 0:8024c367e29f | 37 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
emilmont | 0:8024c367e29f | 38 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC, |
emilmont | 0:8024c367e29f | 39 | const char *name = NULL); |
emilmont | 0:8024c367e29f | 40 | |
emilmont | 0:8024c367e29f | 41 | BusIn(PinName pins[16], const char *name = NULL); |
emilmont | 0:8024c367e29f | 42 | |
emilmont | 0:8024c367e29f | 43 | virtual ~BusIn(); |
emilmont | 0:8024c367e29f | 44 | |
emilmont | 0:8024c367e29f | 45 | /* Group: Access Methods */ |
emilmont | 0:8024c367e29f | 46 | |
emilmont | 0:8024c367e29f | 47 | /* Function: read |
emilmont | 0:8024c367e29f | 48 | * Read the value of the input bus |
emilmont | 0:8024c367e29f | 49 | * |
emilmont | 0:8024c367e29f | 50 | * Variables: |
emilmont | 0:8024c367e29f | 51 | * returns - An integer with each bit corresponding to the value read from the associated DigitalIn pin |
emilmont | 0:8024c367e29f | 52 | */ |
emilmont | 0:8024c367e29f | 53 | int read(); |
emilmont | 0:8024c367e29f | 54 | |
emilmont | 0:8024c367e29f | 55 | #ifdef MBED_OPERATORS |
emilmont | 0:8024c367e29f | 56 | /* Group: Access Method Shorthand */ |
emilmont | 0:8024c367e29f | 57 | |
emilmont | 0:8024c367e29f | 58 | /* Function: operator int() |
emilmont | 0:8024c367e29f | 59 | * A shorthand for <read> |
emilmont | 0:8024c367e29f | 60 | */ |
emilmont | 0:8024c367e29f | 61 | operator int(); |
emilmont | 0:8024c367e29f | 62 | #endif |
emilmont | 0:8024c367e29f | 63 | |
emilmont | 0:8024c367e29f | 64 | #ifdef MBED_RPC |
emilmont | 0:8024c367e29f | 65 | virtual const struct rpc_method *get_rpc_methods(); |
emilmont | 0:8024c367e29f | 66 | static struct rpc_class *get_rpc_class(); |
emilmont | 0:8024c367e29f | 67 | #endif |
emilmont | 0:8024c367e29f | 68 | |
emilmont | 0:8024c367e29f | 69 | protected: |
emilmont | 0:8024c367e29f | 70 | |
emilmont | 0:8024c367e29f | 71 | DigitalIn* _pin[16]; |
emilmont | 0:8024c367e29f | 72 | |
emilmont | 0:8024c367e29f | 73 | #ifdef MBED_RPC |
emilmont | 0:8024c367e29f | 74 | static void construct(const char *arguments, char *res); |
emilmont | 0:8024c367e29f | 75 | #endif |
emilmont | 0:8024c367e29f | 76 | |
emilmont | 0:8024c367e29f | 77 | }; |
emilmont | 0:8024c367e29f | 78 | |
emilmont | 0:8024c367e29f | 79 | } // namespace mbed |
emilmont | 0:8024c367e29f | 80 | |
emilmont | 0:8024c367e29f | 81 | #endif |
emilmont | 0:8024c367e29f | 82 |