similar robotis communication v1.0 in this lib use for protocol to control and diagnotic robot
Fork of Communication_Robot by
communication.h@3:2f334f0cee75, 2015-03-02 (annotated)
- Committer:
- soulx
- Date:
- Mon Mar 02 05:52:56 2015 +0000
- Revision:
- 3:2f334f0cee75
- Parent:
- 2:56c1de1612dd
add paramter addres of instruction control
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
soulx | 0:0c88691e3904 | 1 | #ifndef ANDANTE_COMMUNICATION_H |
soulx | 0:0c88691e3904 | 2 | #define ANDANTE_COMMUNICATION_H |
soulx | 0:0c88691e3904 | 3 | |
soulx | 0:0c88691e3904 | 4 | #include "mbed.h" |
soulx | 0:0c88691e3904 | 5 | #include "iSerial.h" |
soulx | 0:0c88691e3904 | 6 | #include "protocol.h" |
soulx | 0:0c88691e3904 | 7 | #include "Utilities.h" |
soulx | 0:0c88691e3904 | 8 | |
soulx | 2:56c1de1612dd | 9 | //#define ANDANTE_DEBUG |
soulx | 1:1f6864549b92 | 10 | |
soulx | 1:1f6864549b92 | 11 | |
soulx | 0:0c88691e3904 | 12 | class COMMUNICATION |
soulx | 0:0c88691e3904 | 13 | { |
soulx | 0:0c88691e3904 | 14 | private: |
soulx | 2:56c1de1612dd | 15 | Serial *pc; |
soulx | 0:0c88691e3904 | 16 | iSerial *serialCom; |
soulx | 0:0c88691e3904 | 17 | |
soulx | 0:0c88691e3904 | 18 | public: |
soulx | 0:0c88691e3904 | 19 | /** Send the MX28 packet over the serial half duplex connection. |
soulx | 0:0c88691e3904 | 20 | * |
soulx | 0:0c88691e3904 | 21 | * @param packet The MX28 packet. |
soulx | 0:0c88691e3904 | 22 | * @return MX28_ERRBIT_NONE if succeeded, error code otherwise. |
soulx | 0:0c88691e3904 | 23 | */ |
soulx | 1:1f6864549b92 | 24 | uint8_t sendCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet); |
soulx | 1:1f6864549b92 | 25 | uint8_t receiveCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet); |
soulx | 0:0c88691e3904 | 26 | |
soulx | 0:0c88691e3904 | 27 | /** Create an MX28 servo object connected to the specified serial half duplex pins, |
soulx | 0:0c88691e3904 | 28 | * with the specified baudrate. |
soulx | 0:0c88691e3904 | 29 | * |
soulx | 0:0c88691e3904 | 30 | * @param tx Send pin. |
soulx | 0:0c88691e3904 | 31 | * @param rx Receive pin. |
soulx | 0:0c88691e3904 | 32 | * @param baudrate The bus speed. |
soulx | 0:0c88691e3904 | 33 | */ |
soulx | 0:0c88691e3904 | 34 | COMMUNICATION(PinName tx, PinName rx, uint32_t baudRate, uint16_t tx_buff=1000, uint16_t rx_buff=1000 ); |
soulx | 0:0c88691e3904 | 35 | |
soulx | 0:0c88691e3904 | 36 | /** Destroy an MX28 servo object |
soulx | 0:0c88691e3904 | 37 | */ |
soulx | 0:0c88691e3904 | 38 | ~COMMUNICATION(); |
soulx | 0:0c88691e3904 | 39 | }; |
soulx | 0:0c88691e3904 | 40 | |
soulx | 0:0c88691e3904 | 41 | #endif // MX28_H |