Programme d'utilisation des AX12 avec rajout de l'MX12

Fork of test_carteAToutFaire_PR by CRAC Team

Committer:
R66Y
Date:
Sat May 20 15:23:58 2017 +0000
Revision:
3:1bb26049bdd1
Parent:
1:f3f702086a30
Programme de contr?le des AX12 avec rajout de l'MX12;

Who changed what in which revision?

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