Programme d'utilisation des AX12 avec rajout de l'MX12
Fork of test_carteAToutFaire_PR by
mbed/BusIn.h@3:1bb26049bdd1, 2017-05-20 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
ClementBreteau | 1:f3f702086a30 | 1 | /* mbed Microcontroller Library - DigitalIn |
ClementBreteau | 1:f3f702086a30 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
ClementBreteau | 1:f3f702086a30 | 3 | */ |
ClementBreteau | 1:f3f702086a30 | 4 | |
ClementBreteau | 1:f3f702086a30 | 5 | #ifndef MBED_BUSIN_H |
ClementBreteau | 1:f3f702086a30 | 6 | #define MBED_BUSIN_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 "DigitalIn.h" |
ClementBreteau | 1:f3f702086a30 | 13 | |
ClementBreteau | 1:f3f702086a30 | 14 | namespace mbed { |
ClementBreteau | 1:f3f702086a30 | 15 | |
ClementBreteau | 1:f3f702086a30 | 16 | /* Class: BusIn |
ClementBreteau | 1:f3f702086a30 | 17 | * A digital input bus, used for reading the state of a collection of pins |
ClementBreteau | 1:f3f702086a30 | 18 | */ |
ClementBreteau | 1:f3f702086a30 | 19 | class BusIn : 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: BusIn |
ClementBreteau | 1:f3f702086a30 | 26 | * Create an BusIn, connected to the specified pins |
ClementBreteau | 1:f3f702086a30 | 27 | * |
ClementBreteau | 1:f3f702086a30 | 28 | * Variables: |
ClementBreteau | 1:f3f702086a30 | 29 | * p<n> - DigitalIn pin to connect to bus bit <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 | BusIn(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 | BusIn(PinName pins[16], const char *name = NULL); |
ClementBreteau | 1:f3f702086a30 | 42 | |
ClementBreteau | 1:f3f702086a30 | 43 | virtual ~BusIn(); |
ClementBreteau | 1:f3f702086a30 | 44 | |
ClementBreteau | 1:f3f702086a30 | 45 | /* Group: Access Methods */ |
ClementBreteau | 1:f3f702086a30 | 46 | |
ClementBreteau | 1:f3f702086a30 | 47 | /* Function: read |
ClementBreteau | 1:f3f702086a30 | 48 | * Read the value of the input bus |
ClementBreteau | 1:f3f702086a30 | 49 | * |
ClementBreteau | 1:f3f702086a30 | 50 | * Variables: |
ClementBreteau | 1:f3f702086a30 | 51 | * returns - An integer with each bit corresponding to the value read from the associated DigitalIn pin |
ClementBreteau | 1:f3f702086a30 | 52 | */ |
ClementBreteau | 1:f3f702086a30 | 53 | int read(); |
ClementBreteau | 1:f3f702086a30 | 54 | |
ClementBreteau | 1:f3f702086a30 | 55 | #ifdef MBED_OPERATORS |
ClementBreteau | 1:f3f702086a30 | 56 | /* Group: Access Method Shorthand */ |
ClementBreteau | 1:f3f702086a30 | 57 | |
ClementBreteau | 1:f3f702086a30 | 58 | /* Function: operator int() |
ClementBreteau | 1:f3f702086a30 | 59 | * A shorthand for <read> |
ClementBreteau | 1:f3f702086a30 | 60 | */ |
ClementBreteau | 1:f3f702086a30 | 61 | operator int(); |
ClementBreteau | 1:f3f702086a30 | 62 | #endif |
ClementBreteau | 1:f3f702086a30 | 63 | |
ClementBreteau | 1:f3f702086a30 | 64 | #ifdef MBED_RPC |
ClementBreteau | 1:f3f702086a30 | 65 | virtual const struct rpc_method *get_rpc_methods(); |
ClementBreteau | 1:f3f702086a30 | 66 | static struct rpc_class *get_rpc_class(); |
ClementBreteau | 1:f3f702086a30 | 67 | #endif |
ClementBreteau | 1:f3f702086a30 | 68 | |
ClementBreteau | 1:f3f702086a30 | 69 | protected: |
ClementBreteau | 1:f3f702086a30 | 70 | |
ClementBreteau | 1:f3f702086a30 | 71 | DigitalIn* _pin[16]; |
ClementBreteau | 1:f3f702086a30 | 72 | |
ClementBreteau | 1:f3f702086a30 | 73 | #ifdef MBED_RPC |
ClementBreteau | 1:f3f702086a30 | 74 | static void construct(const char *arguments, char *res); |
ClementBreteau | 1:f3f702086a30 | 75 | #endif |
ClementBreteau | 1:f3f702086a30 | 76 | |
ClementBreteau | 1:f3f702086a30 | 77 | }; |
ClementBreteau | 1:f3f702086a30 | 78 | |
ClementBreteau | 1:f3f702086a30 | 79 | } // namespace mbed |
ClementBreteau | 1:f3f702086a30 | 80 | |
ClementBreteau | 1:f3f702086a30 | 81 | #endif |
ClementBreteau | 1:f3f702086a30 | 82 |