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