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: shared/I2CMD/I2CMD.h
- Revision:
- 0:ee7e9405e1c7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/I2CMD/I2CMD.h Wed Apr 14 07:26:19 2021 +0000
@@ -0,0 +1,30 @@
+#ifndef I2CMD_H_
+#define I2CMD_H_
+
+#include <mbed.h>
+#include <shared/MD/MD.h>
+
+class I2CMD : public MD
+{
+public:
+ I2CMD(I2C *i2c_bus, int i2c_address, int motor_id, int retries = 10);
+ virtual void drive(double);
+ virtual void brake(double);
+ virtual void free();
+
+ void set_retries(int);
+ bool get_error();
+
+private:
+ bool i2c_write(int command, char *data, int length);
+ uint8_t conv_strength_to_duty_u8(double);
+
+ I2C *_i2c_bus;
+ int _i2c_address;
+ int _motor_id;
+
+ int _retries;
+ bool _error;
+};
+
+#endif