strat des robots
Fork of CRAC-Strat_2017 by
mbed/BusInOut.h@0:ad97421fb1fb, 2016-04-13 (annotated)
- Committer:
- antbig
- Date:
- Wed Apr 13 22:04:54 2016 +0000
- Revision:
- 0:ad97421fb1fb
Ajout interruption fin de match
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antbig | 0:ad97421fb1fb | 1 | /* mbed Microcontroller Library - BusInOut |
antbig | 0:ad97421fb1fb | 2 | * Copyright (c) 2009 ARM Limited. All rights reserved. |
antbig | 0:ad97421fb1fb | 3 | */ |
antbig | 0:ad97421fb1fb | 4 | |
antbig | 0:ad97421fb1fb | 5 | #ifndef MBED_BUSINOUT_H |
antbig | 0:ad97421fb1fb | 6 | #define MBED_BUSINOUT_H |
antbig | 0:ad97421fb1fb | 7 | |
antbig | 0:ad97421fb1fb | 8 | #include "platform.h" |
antbig | 0:ad97421fb1fb | 9 | #include "PinNames.h" |
antbig | 0:ad97421fb1fb | 10 | #include "PeripheralNames.h" |
antbig | 0:ad97421fb1fb | 11 | #include "Base.h" |
antbig | 0:ad97421fb1fb | 12 | #include "DigitalInOut.h" |
antbig | 0:ad97421fb1fb | 13 | |
antbig | 0:ad97421fb1fb | 14 | namespace mbed { |
antbig | 0:ad97421fb1fb | 15 | |
antbig | 0:ad97421fb1fb | 16 | /* Class: BusInOut |
antbig | 0:ad97421fb1fb | 17 | * A digital input output bus, used for setting the state of a collection of pins |
antbig | 0:ad97421fb1fb | 18 | */ |
antbig | 0:ad97421fb1fb | 19 | class BusInOut : public Base { |
antbig | 0:ad97421fb1fb | 20 | |
antbig | 0:ad97421fb1fb | 21 | public: |
antbig | 0:ad97421fb1fb | 22 | |
antbig | 0:ad97421fb1fb | 23 | /* Group: Configuration Methods */ |
antbig | 0:ad97421fb1fb | 24 | |
antbig | 0:ad97421fb1fb | 25 | /* Constructor: BusInOut |
antbig | 0:ad97421fb1fb | 26 | * Create an BusInOut, connected to the specified pins |
antbig | 0:ad97421fb1fb | 27 | * |
antbig | 0:ad97421fb1fb | 28 | * Variables: |
antbig | 0:ad97421fb1fb | 29 | * p<n> - DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC) |
antbig | 0:ad97421fb1fb | 30 | * |
antbig | 0:ad97421fb1fb | 31 | * Note: |
antbig | 0:ad97421fb1fb | 32 | * It is only required to specify as many pin variables as is required |
antbig | 0:ad97421fb1fb | 33 | * for the bus; the rest will default to NC (not connected) |
antbig | 0:ad97421fb1fb | 34 | */ |
antbig | 0:ad97421fb1fb | 35 | BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
antbig | 0:ad97421fb1fb | 36 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
antbig | 0:ad97421fb1fb | 37 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
antbig | 0:ad97421fb1fb | 38 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC, |
antbig | 0:ad97421fb1fb | 39 | const char *name = NULL); |
antbig | 0:ad97421fb1fb | 40 | |
antbig | 0:ad97421fb1fb | 41 | BusInOut(PinName pins[16], const char *name = NULL); |
antbig | 0:ad97421fb1fb | 42 | |
antbig | 0:ad97421fb1fb | 43 | virtual ~BusInOut(); |
antbig | 0:ad97421fb1fb | 44 | |
antbig | 0:ad97421fb1fb | 45 | /* Group: Access Methods */ |
antbig | 0:ad97421fb1fb | 46 | |
antbig | 0:ad97421fb1fb | 47 | /* Function: write |
antbig | 0:ad97421fb1fb | 48 | * Write the value to the output bus |
antbig | 0:ad97421fb1fb | 49 | * |
antbig | 0:ad97421fb1fb | 50 | * Variables: |
antbig | 0:ad97421fb1fb | 51 | * value - An integer specifying a bit to write for every corresponding DigitalInOut pin |
antbig | 0:ad97421fb1fb | 52 | */ |
antbig | 0:ad97421fb1fb | 53 | void write(int value); |
antbig | 0:ad97421fb1fb | 54 | |
antbig | 0:ad97421fb1fb | 55 | |
antbig | 0:ad97421fb1fb | 56 | /* Function: read |
antbig | 0:ad97421fb1fb | 57 | * Read the value currently output on the bus |
antbig | 0:ad97421fb1fb | 58 | * |
antbig | 0:ad97421fb1fb | 59 | * Variables: |
antbig | 0:ad97421fb1fb | 60 | * returns - An integer with each bit corresponding to associated DigitalInOut pin setting |
antbig | 0:ad97421fb1fb | 61 | */ |
antbig | 0:ad97421fb1fb | 62 | int read(); |
antbig | 0:ad97421fb1fb | 63 | |
antbig | 0:ad97421fb1fb | 64 | /* Function: output |
antbig | 0:ad97421fb1fb | 65 | * Set as an output |
antbig | 0:ad97421fb1fb | 66 | */ |
antbig | 0:ad97421fb1fb | 67 | void output(); |
antbig | 0:ad97421fb1fb | 68 | |
antbig | 0:ad97421fb1fb | 69 | /* Function: input |
antbig | 0:ad97421fb1fb | 70 | * Set as an input |
antbig | 0:ad97421fb1fb | 71 | */ |
antbig | 0:ad97421fb1fb | 72 | void input(); |
antbig | 0:ad97421fb1fb | 73 | |
antbig | 0:ad97421fb1fb | 74 | /* Function: mode |
antbig | 0:ad97421fb1fb | 75 | * Set the input pin mode |
antbig | 0:ad97421fb1fb | 76 | * |
antbig | 0:ad97421fb1fb | 77 | * Variables: |
antbig | 0:ad97421fb1fb | 78 | * mode - PullUp, PullDown, PullNone |
antbig | 0:ad97421fb1fb | 79 | */ |
antbig | 0:ad97421fb1fb | 80 | void mode(PinMode pull); |
antbig | 0:ad97421fb1fb | 81 | |
antbig | 0:ad97421fb1fb | 82 | #ifdef MBED_OPERATORS |
antbig | 0:ad97421fb1fb | 83 | /* Group: Access Method Shorthand */ |
antbig | 0:ad97421fb1fb | 84 | |
antbig | 0:ad97421fb1fb | 85 | /* Function: operator= |
antbig | 0:ad97421fb1fb | 86 | * A shorthand for <write> |
antbig | 0:ad97421fb1fb | 87 | */ |
antbig | 0:ad97421fb1fb | 88 | BusInOut& operator= (int v); |
antbig | 0:ad97421fb1fb | 89 | BusInOut& operator= (BusInOut& rhs); |
antbig | 0:ad97421fb1fb | 90 | |
antbig | 0:ad97421fb1fb | 91 | /* Function: operator int() |
antbig | 0:ad97421fb1fb | 92 | * A shorthand for <read> |
antbig | 0:ad97421fb1fb | 93 | */ |
antbig | 0:ad97421fb1fb | 94 | operator int(); |
antbig | 0:ad97421fb1fb | 95 | #endif |
antbig | 0:ad97421fb1fb | 96 | |
antbig | 0:ad97421fb1fb | 97 | #ifdef MBED_RPC |
antbig | 0:ad97421fb1fb | 98 | virtual const struct rpc_method *get_rpc_methods(); |
antbig | 0:ad97421fb1fb | 99 | static struct rpc_class *get_rpc_class(); |
antbig | 0:ad97421fb1fb | 100 | #endif |
antbig | 0:ad97421fb1fb | 101 | |
antbig | 0:ad97421fb1fb | 102 | protected: |
antbig | 0:ad97421fb1fb | 103 | |
antbig | 0:ad97421fb1fb | 104 | DigitalInOut* _pin[16]; |
antbig | 0:ad97421fb1fb | 105 | |
antbig | 0:ad97421fb1fb | 106 | #ifdef MBED_RPC |
antbig | 0:ad97421fb1fb | 107 | static void construct(const char *arguments, char *res); |
antbig | 0:ad97421fb1fb | 108 | #endif |
antbig | 0:ad97421fb1fb | 109 | |
antbig | 0:ad97421fb1fb | 110 | }; |
antbig | 0:ad97421fb1fb | 111 | |
antbig | 0:ad97421fb1fb | 112 | } // namespace mbed |
antbig | 0:ad97421fb1fb | 113 | |
antbig | 0:ad97421fb1fb | 114 | #endif |
antbig | 0:ad97421fb1fb | 115 |