ใช้กับขาหมา
Dependents: BEAR_Protocol BEAR_Reciever BETAGO
Fork of Communication_Robot by
communication.h@4:36edd0a81d8e, 2015-12-23 (annotated)
- Committer:
- b0ssiz
- Date:
- Wed Dec 23 13:04:38 2015 +0000
- Revision:
- 4:36edd0a81d8e
- Parent:
- 2:56c1de1612dd
- Child:
- 10:dfcb16b99b85
delete comment #define ANDANTE_DEBUG
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 | |
b0ssiz | 4:36edd0a81d8e | 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 |