メカナムのコード

Dependencies:   mbed Eigen

Committer:
e2011220
Date:
Wed Apr 14 07:26:19 2021 +0000
Revision:
0:ee7e9405e1c7
first

Who changed what in which revision?

UserRevisionLine numberNew contents of line
e2011220 0:ee7e9405e1c7 1 #ifndef I2CMDMAIN_H_
e2011220 0:ee7e9405e1c7 2 #define I2CMDMAIN_H_
e2011220 0:ee7e9405e1c7 3
e2011220 0:ee7e9405e1c7 4 #include <mbed.h>
e2011220 0:ee7e9405e1c7 5 #include <shared/MD/MD.h>
e2011220 0:ee7e9405e1c7 6
e2011220 0:ee7e9405e1c7 7 class I2CMDMain : public MD
e2011220 0:ee7e9405e1c7 8 {
e2011220 0:ee7e9405e1c7 9 public:
e2011220 0:ee7e9405e1c7 10 I2CMDMain(I2C *i2c_bus, int i2c_address, int motor_id, int retries = 10);
e2011220 0:ee7e9405e1c7 11 virtual void drive(double);
e2011220 0:ee7e9405e1c7 12 virtual void brake(double);
e2011220 0:ee7e9405e1c7 13 virtual void free();
e2011220 0:ee7e9405e1c7 14
e2011220 0:ee7e9405e1c7 15 void set_retries(int);
e2011220 0:ee7e9405e1c7 16 bool get_error();
e2011220 0:ee7e9405e1c7 17
e2011220 0:ee7e9405e1c7 18 bool i2c_send();
e2011220 0:ee7e9405e1c7 19
e2011220 0:ee7e9405e1c7 20 private:
e2011220 0:ee7e9405e1c7 21 bool i2c_write(int command, char *data, int length);
e2011220 0:ee7e9405e1c7 22 uint8_t conv_strength_to_duty_u8(double);
e2011220 0:ee7e9405e1c7 23
e2011220 0:ee7e9405e1c7 24 I2C *_i2c_bus;
e2011220 0:ee7e9405e1c7 25 int _i2c_address;
e2011220 0:ee7e9405e1c7 26 int _motor_id;
e2011220 0:ee7e9405e1c7 27
e2011220 0:ee7e9405e1c7 28 int _retries;
e2011220 0:ee7e9405e1c7 29 bool _error;
e2011220 0:ee7e9405e1c7 30
e2011220 0:ee7e9405e1c7 31 char send_data[4];
e2011220 0:ee7e9405e1c7 32 int send_length;
e2011220 0:ee7e9405e1c7 33 bool send_flg;
e2011220 0:ee7e9405e1c7 34 };
e2011220 0:ee7e9405e1c7 35
e2011220 0:ee7e9405e1c7 36 #endif