From d515f6f3d16711a8dd56bcd22fdbabad85ffbce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu> Date: Tue, 20 Oct 2015 12:53:17 +0000 Subject: [PATCH] Added the battery status and pack status information to the list of info read from the battery. Modified the labrobotica driver to use the CDynamixel interface. --- include/mem.h | 30 +++++++++++++++++------------- include/smbus.h | 2 ++ src/smbus.c | 4 +++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/mem.h b/include/mem.h index 75a5ff1..1924cc2 100644 --- a/include/mem.h +++ b/include/mem.h @@ -38,20 +38,24 @@ #define Bat_charge_current_H 0x37 #define Bat_charge_voltage_L 0x38 #define Bat_charge_voltage_H 0x39 -#define Bat_design_capacity_L 0x3A -#define Bat_design_capacity_H 0x3B -#define Bat_design_voltage_L 0x3C -#define Bat_design_voltage_H 0x3D -#define Bat_cell4_voltage_L 0x3E -#define Bat_cell4_voltage_H 0x3F -#define Bat_cell3_voltage_L 0x40 -#define Bat_cell3_voltage_H 0x41 -#define Bat_cell2_voltage_L 0x42 -#define Bat_cell2_voltage_H 0x43 -#define Bat_cell1_voltage_L 0x44 -#define Bat_cell1_voltage_H 0x45 +#define Bat_status_L 0x3A +#define Bat_status_H 0x3B +#define Bat_design_capacity_L 0x3C +#define Bat_design_capacity_H 0x3D +#define Bat_design_voltage_L 0x3E +#define Bat_design_voltage_H 0x3F +#define Bat_pack_status_L 0x40 +#define Bat_pack_status_H 0x41 +#define Bat_cell4_voltage_L 0x42 +#define Bat_cell4_voltage_H 0x43 +#define Bat_cell3_voltage_L 0x44 +#define Bat_cell3_voltage_H 0x45 +#define Bat_cell2_voltage_L 0x56 +#define Bat_cell2_voltage_H 0x47 +#define Bat_cell1_voltage_L 0x48 +#define Bat_cell1_voltage_H 0x49 -#define RAM_SIZE 70 +#define RAM_SIZE 74 extern unsigned char ram_data[RAM_SIZE]; diff --git a/include/smbus.h b/include/smbus.h index a360ffa..ffa8554 100644 --- a/include/smbus.h +++ b/include/smbus.h @@ -18,8 +18,10 @@ #define AverageTimeToFull 0x13 #define ChargingCurrent 0x14 #define ChargingVoltage 0x15 +#define BatteryStatus 0x16 #define DesignCapacity 0x18 #define DesignVoltage 0x19 +#define PackStatus 0x2f #define VCELL4 0x3c #define VCELL3 0x3d #define VCELL2 0x3e diff --git a/src/smbus.c b/src/smbus.c index 62db762..5b9ed42 100644 --- a/src/smbus.c +++ b/src/smbus.c @@ -24,15 +24,17 @@ TSMBusCmd commands[]={{Temperature,Bat_temperature_L}, {AverageTimeToFull,Bat_avg_time_full_L}, {ChargingCurrent,Bat_charge_current_L}, {ChargingVoltage,Bat_charge_voltage_L}, + {BatteryStatus,Bat_status_L}, {DesignCapacity,Bat_design_capacity_L}, {DesignVoltage,Bat_design_voltage_L}, + {PackStatus,Bat_pack_status_L}, {VCELL4,Bat_cell4_voltage_L}, {VCELL3,Bat_cell3_voltage_L}, {VCELL2,Bat_cell2_voltage_L}, {VCELL1,Bat_cell1_voltage_L}}; unsigned char current_cmd; -#define NUM_COMMANDS 19 +#define NUM_COMMANDS 21 /* private functions */ -- GitLab