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