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