rrrrr
Fork of Communication_Robot by
communication.h@1:1f6864549b92, 2015-03-01 (annotated)
- Committer:
- soulx
- Date:
- Sun Mar 01 08:48:23 2015 +0000
- Revision:
- 1:1f6864549b92
- Parent:
- 0:0c88691e3904
- Child:
- 2:56c1de1612dd
create communication with protocol similar robotis protocol; -receive; -not send
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 | 1:1f6864549b92 | 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 | 0:0c88691e3904 | 15 | iSerial *serialCom; |
soulx | 0:0c88691e3904 | 16 | |
soulx | 0:0c88691e3904 | 17 | public: |
soulx | 0:0c88691e3904 | 18 | /** Send the MX28 packet over the serial half duplex connection. |
soulx | 0:0c88691e3904 | 19 | * |
soulx | 0:0c88691e3904 | 20 | * @param packet The MX28 packet. |
soulx | 0:0c88691e3904 | 21 | * @return MX28_ERRBIT_NONE if succeeded, error code otherwise. |
soulx | 0:0c88691e3904 | 22 | */ |
soulx | 1:1f6864549b92 | 23 | uint8_t sendCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet); |
soulx | 1:1f6864549b92 | 24 | uint8_t receiveCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet); |
soulx | 0:0c88691e3904 | 25 | |
soulx | 0:0c88691e3904 | 26 | /** Create an MX28 servo object connected to the specified serial half duplex pins, |
soulx | 0:0c88691e3904 | 27 | * with the specified baudrate. |
soulx | 0:0c88691e3904 | 28 | * |
soulx | 0:0c88691e3904 | 29 | * @param tx Send pin. |
soulx | 0:0c88691e3904 | 30 | * @param rx Receive pin. |
soulx | 0:0c88691e3904 | 31 | * @param baudrate The bus speed. |
soulx | 0:0c88691e3904 | 32 | */ |
soulx | 0:0c88691e3904 | 33 | COMMUNICATION(PinName tx, PinName rx, uint32_t baudRate, uint16_t tx_buff=1000, uint16_t rx_buff=1000 ); |
soulx | 0:0c88691e3904 | 34 | |
soulx | 0:0c88691e3904 | 35 | /** Destroy an MX28 servo object |
soulx | 0:0c88691e3904 | 36 | */ |
soulx | 0:0c88691e3904 | 37 | ~COMMUNICATION(); |
soulx | 0:0c88691e3904 | 38 | }; |
soulx | 0:0c88691e3904 | 39 | |
soulx | 0:0c88691e3904 | 40 | #endif // MX28_H |