31 #define MD25_REG_SPEED1 0x00
32 #define MD25_REG_SPEED2 0x01
33 #define MD25_REG_ENCODER1 0x02
34 #define MD25_REG_ENCODER2 0x06
35 #define MD25_REG_BAT 0x0A
36 #define MD25_REG_CURRENT1 0x0B
37 #define MD25_REG_CURRENT2 0x0C
38 #define MD25_REG_SOFT_REV 0x0D
39 #define MD25_REG_ACCEL_RATE 0x0E
40 #define MD25_REG_MODE 0x0F
41 #define MD25_REG_COMMAND 0x10
43 #define MD25_CMD_RESET_ENCODERS 0x20
44 #define MD25_CMD_NO_SPEED_REGUL 0x30
45 #define MD25_CMD_SPEED_REGUL 0x31
46 #define MD25_CMD_NO_MOTOR_TIMEOUT 0x32
47 #define MD25_CMD_MOTOR_TIMEOUT 0x33
50 #define MD25_MODE0 0 // motor1 speed, motor2 speed [0, 255] (default)
51 #define MD25_MODE1 1 // motor1 speed, motor2 speed [-128, 127]
52 #define MD25_MODE2 2 // speed, turn [0, 255]
53 #define MD25_MODE3 3 // speed, turn [-128, 127]
56 #ifndef ACTUATORS_MD25_MODE
57 #define ACTUATORS_MD25_MODE MD25_MODE0
61 #ifndef ACTUATORS_MD25_ACCEL_RATE
62 #define ACTUATORS_MD25_ACCEL_RATE 5
66 #ifndef ACTUATORS_MD25_I2C_ADDR
67 #define ACTUATORS_MD25_I2C_ADDR 0xB0
71 PRINT_CONFIG_VAR(ACTUATORS_MD25_DEV)
78 actuators_md25.
bat = 0;
79 actuators_md25.
cmds[0] = 0;
80 actuators_md25.
cmds[1] = 0;
118 #define Int32FromBuf(_buf,_idx) ((int32_t)(((uint32_t)_buf[_idx]<<24) | ((uint32_t)_buf[_idx+1]<<16) | ((uint32_t)_buf[_idx+2]<<8) | _buf[_idx+3]))
int32_t encoders[2]
encoder values
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
transaction successfully finished by I2C driver
void actuators_md25_set(void)
void actuators_md25_event(void)
#define ACTUATORS_MD25_MODE
#define ACTUATORS_MD25_I2C_ADDR
Hardware independent API for actuators (servos, motor controllers).
#define MD25_REG_ACCEL_RATE
struct i2c_transaction trans_sensors
i2c struct for sensors
#define MD25_REG_ENCODER1
transaction set to done by user level
uint8_t accel_rate
accel rate (from 1 to 10)
void actuators_md25_init(void)
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
enum I2CTransactionStatus status
Transaction status.
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
uint8_t bat
batterie voltage (in decivolt)
#define Int32FromBuf(_buf, _idx)
struct i2c_transaction trans_cmd
i2c struct for command
bool initialized
init flag
struct ActuatorsMD25 actuators_md25
uint8_t current[2]
current in motors (in deciamp)
void actuators_md25_periodic(void)
#define ACTUATORS_MD25_ACCEL_RATE