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.
Diff: MX12.h
- Revision:
- 9:b4a5187fdec6
- Parent:
- 8:e74ef93ae660
- Child:
- 10:ca9afe156ee1
--- a/MX12.h Sat Nov 06 08:29:28 2021 +0000
+++ b/MX12.h Sat Nov 06 16:15:34 2021 +0000
@@ -1,5 +1,5 @@
/**
- * @file MX12.h
+ * @file MX12.h
* @brief this header file will contain all required definitions and
* basic utilities functions to manage au bus of servomotor
* Dynaminel MX12
@@ -89,6 +89,8 @@
* returns an enumation type "Status". As several errors can be reported
* simultaneously the type enum is not suitable (B. Denis 11/2021)
*
+ * @bug
+ *
* _frame_pointer variable is used by _ReadCallback() ISR to store the
* current size for message (status packet) received from servomotor.
* This variable is NOT initialised and NEVER reset to zero at each new
@@ -129,18 +131,6 @@
Ok ///< no error
};
- /** State of packet parser to determine the meaning of reading byte
- * into the received packet (status packet) according the Dynamixel
- * protocol v1.0
- */
- enum ParsingState {
- Header, ///< reading the two heading bytes
- Id, ///< reading the servomotor ID byte
- Length, ///< reading byte length of the instruction
- Data, ///< reading parameters
- Checksum ///< reading one bytes checksum
- };
-
/** Enumeration of states of the acces methode of the master-slave
* protocol of the communication between the robot controller (master)
* and the servomotors (slaves).
@@ -165,7 +155,20 @@
unsigned char valid; /**< */
};
- /**
+ /** State of packet parser store which section of a status packet
+ * (according the Dynamixel according the Dynamixel) is currently reading
+ * from a servomotor return message.
+ */
+ enum ParsingState {
+ Header, ///< reading the two heading bytes
+ Id, ///< reading the servomotor ID byte
+ Length, ///< reading byte length of the instruction
+ Data, ///< reading parameters
+ Checksum ///< reading one bytes checksum
+ };
+
+ /** Complement to the ParsingState enumeration to store the reading
+ * progress of each section of the status packet.
*/
struct StateContext {
unsigned char headingCount;
@@ -193,6 +196,8 @@
*/
void SetSpeed(unsigned char mot_id, float speed);
+ /**
+ */
char IsAvailable(void);
/**
@@ -245,6 +250,11 @@
* @warning
* If a combination of several errors is reported the function
* returns 'Unknown' (B. Denis 11/2021)
+ *
+ * @bug
+ * This method has a hazardous behavior because it provides a result by
+ * reading the content of the variable _current_frame which can be
+ * modified at any time by the private ISR _ReadCallback()
*/
MX12::Status GetStatus(void);
@@ -253,11 +263,11 @@
// MX12::Status GetStatus(void);
// void ReadPosition(unsigned char mot_id);
// float GetPosition(unsigned char mot_id);
- int get_counter();
-
private:
+ /*
+ */
UnbufferedSerial _mx12;
MX12::ParsingState _pstate;
MX12::SerialState _sstate;
@@ -284,9 +294,7 @@
* @warning
*/
unsigned char _frame_pointer;
-
- volatile int _BDcount;
-
+
/** Interupt service routine (ISR) to read and parse the response message
* comming from servomotor on UART (serial port). This routine is called
* when each character is received on the servomotor bus.
@@ -297,8 +305,6 @@
*/
void _ReadCallback();
- void _Rx_BD_interrupt();
-
};
#endif /* MBED_MX12_H_ */
\ No newline at end of file