Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Communication_Robot by
communication.h@0:0c88691e3904, 2015-03-01 (annotated)
- Committer:
- soulx
- Date:
- Sun Mar 01 06:28:01 2015 +0000
- Revision:
- 0:0c88691e3904
- Child:
- 1:1f6864549b92
create lib communication for robot
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 | 0:0c88691e3904 | 9 | class COMMUNICATION |
| soulx | 0:0c88691e3904 | 10 | { |
| soulx | 0:0c88691e3904 | 11 | private: |
| soulx | 0:0c88691e3904 | 12 | iSerial *serialCom; |
| soulx | 0:0c88691e3904 | 13 | |
| soulx | 0:0c88691e3904 | 14 | public: |
| soulx | 0:0c88691e3904 | 15 | /** Send the MX28 packet over the serial half duplex connection. |
| soulx | 0:0c88691e3904 | 16 | * |
| soulx | 0:0c88691e3904 | 17 | * @param packet The MX28 packet. |
| soulx | 0:0c88691e3904 | 18 | * @return MX28_ERRBIT_NONE if succeeded, error code otherwise. |
| soulx | 0:0c88691e3904 | 19 | */ |
| soulx | 0:0c88691e3904 | 20 | uint8_t CommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet); |
| soulx | 0:0c88691e3904 | 21 | |
| soulx | 0:0c88691e3904 | 22 | /** Create an MX28 servo object connected to the specified serial half duplex pins, |
| soulx | 0:0c88691e3904 | 23 | * with the specified baudrate. |
| soulx | 0:0c88691e3904 | 24 | * |
| soulx | 0:0c88691e3904 | 25 | * @param tx Send pin. |
| soulx | 0:0c88691e3904 | 26 | * @param rx Receive pin. |
| soulx | 0:0c88691e3904 | 27 | * @param baudrate The bus speed. |
| soulx | 0:0c88691e3904 | 28 | */ |
| soulx | 0:0c88691e3904 | 29 | COMMUNICATION(PinName tx, PinName rx, uint32_t baudRate, uint16_t tx_buff=1000, uint16_t rx_buff=1000 ); |
| soulx | 0:0c88691e3904 | 30 | |
| soulx | 0:0c88691e3904 | 31 | /** Destroy an MX28 servo object |
| soulx | 0:0c88691e3904 | 32 | */ |
| soulx | 0:0c88691e3904 | 33 | ~COMMUNICATION(); |
| soulx | 0:0c88691e3904 | 34 | }; |
| soulx | 0:0c88691e3904 | 35 | |
| soulx | 0:0c88691e3904 | 36 | #endif // MX28_H |
