Skip to content

Commit

Permalink
adding mtb4c support
Browse files Browse the repository at this point in the history
  • Loading branch information
davidetome committed Jun 16, 2022
1 parent 79cf7d5 commit aff334e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 20 deletions.
2 changes: 2 additions & 0 deletions can/canProtocolLib/iCubCanProto_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extern "C" {
#define ICUBCANPROTO_BOARDTYPE__MTB4W 16
#define ICUBCANPROTO_BOARDTYPE__PMC 17
#define ICUBCANPROTO_BOARDTYPE__AMCBLDC 18
#define ICUBCANPROTO_BOARDTYPE__MTB4C 19
#define ICUBCANPROTO_BOARDTYPE__UNKNOWN 255

// skin types
Expand Down Expand Up @@ -111,6 +112,7 @@ typedef enum
icubCanProto_boardType__mtb4w = ICUBCANPROTO_BOARDTYPE__MTB4W,
icubCanProto_boardType__pmc = ICUBCANPROTO_BOARDTYPE__PMC,
icubCanProto_boardType__amcbldc = ICUBCANPROTO_BOARDTYPE__AMCBLDC,
icubCanProto_boardType__mtb4c = ICUBCANPROTO_BOARDTYPE__MTB4C,
icubCanProto_boardType__unknown = ICUBCANPROTO_BOARDTYPE__UNKNOWN
} icubCanProto_boardType_t;

Expand Down
37 changes: 32 additions & 5 deletions eth/embobj/plus/comm-v2/icub/EoAnalogSensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ extern eOas_sensor_t eoas_string2sensor(const char * string)
return(eoas_unknown);
}

enum { in3_mtb_pos = 0, in3_mtb4_pos = 1, in3_strain2_pos = 2, in3_rfe_pos = 3 };
enum { in3_mtb_pos = 0, in3_mtb4_pos = 1, in3_strain2_pos = 2, in3_rfe_pos = 3, in3_mtb4c_pos = 4 };

static const eObrd_cantype_t s_eoas_inertial3_supportedboards_types[] = { eobrd_cantype_mtb, eobrd_cantype_mtb4, eobrd_cantype_strain2, eobrd_cantype_rfe };
static const eObrd_cantype_t s_eoas_inertial3_supportedboards_types[] = { eobrd_cantype_mtb, eobrd_cantype_mtb4, eobrd_cantype_strain2, eobrd_cantype_rfe, eobrd_cantype_mtb4c };


extern uint8_t eoas_inertial3_supportedboards_numberof(void)
Expand Down Expand Up @@ -220,7 +220,12 @@ extern eOresult_t eoas_inertial3_setof_boardinfos_add(eOas_inertial3_setof_board
memcpy(&set->data[in3_rfe_pos], brdinfo, sizeof(eObrd_info_t));
return eores_OK;
}


if(eobrd_cantype_mtb4c == brdinfo->type)
{
memcpy(&set->data[in3_mtb4c_pos], brdinfo, sizeof(eObrd_info_t));
return eores_OK;
}
return eores_NOK_generic;
}

Expand Down Expand Up @@ -269,6 +274,14 @@ extern const eObrd_info_t * eoas_inertial3_setof_boardinfos_find(const eOas_iner
}
} break;

case eobrd_cantype_mtb4c:
{
if(eobrd_cantype_mtb4c == set->data[in3_mtb4c_pos].type)
{
r = &set->data[in3_mtb4c_pos];
}
} break;

default:
{
r = NULL;
Expand Down Expand Up @@ -325,9 +338,9 @@ extern eOas_inertial3_type_t eoas_inertial3_canproto_to_imu(uint8_t v)
}


enum { temp_mtb4_pos = 0, temp_strain2_pos = 1 };
enum { temp_mtb4_pos = 0, temp_strain2_pos = 1, temp_mtb4c_pos = 2 };

static const eObrd_cantype_t s_eoas_temperature_supportedboards_types[] = { eobrd_cantype_mtb4, eobrd_cantype_strain2 };
static const eObrd_cantype_t s_eoas_temperature_supportedboards_types[] = { eobrd_cantype_mtb4, eobrd_cantype_strain2, eobrd_cantype_mtb4c };


extern uint8_t eoas_temperature_supportedboards_numberof(void)
Expand Down Expand Up @@ -380,6 +393,12 @@ extern eOresult_t eoas_temperature_setof_boardinfos_add(eOas_temperature_setof_b
{
memcpy(&set->data[temp_strain2_pos], brdinfo, sizeof(eObrd_info_t));
return eores_OK;
}

if(eobrd_cantype_mtb4c == brdinfo->type)
{
memcpy(&set->data[temp_mtb4c_pos], brdinfo, sizeof(eObrd_info_t));
return eores_OK;
}

return eores_NOK_generic;
Expand Down Expand Up @@ -413,6 +432,14 @@ extern const eObrd_info_t * eoas_temperature_setof_boardinfos_find(const eOas_te
}
} break;

case eobrd_cantype_mtb4c:
{
if(eobrd_cantype_mtb4c == set->data[temp_mtb4c_pos].type)
{
r = &set->data[temp_mtb4c_pos];
}
} break;

default:
{
r = NULL;
Expand Down
10 changes: 5 additions & 5 deletions eth/embobj/plus/comm-v2/icub/EoAnalogSensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ typedef struct


// we use this struct to send activate-verify command to the board
enum { eOas_temperature_boardinfos_maxnumber = 2 };
enum { eOas_temperature_boardinfos_maxnumber = 3 };
typedef struct
{ //6*2=12
eObrd_info_t data[eOas_temperature_boardinfos_maxnumber];
} eOas_temperature_setof_boardinfos_t; EO_VERIFYsizeof(eOas_temperature_setof_boardinfos_t, 12)
} eOas_temperature_setof_boardinfos_t; EO_VERIFYsizeof(eOas_temperature_setof_boardinfos_t, 18)


// this struct describes the data acquired by a single temperature sensor
Expand Down Expand Up @@ -487,11 +487,11 @@ typedef struct


// we use this struct to send activate-verify command to the board
enum { eOas_inertials3_boardinfos_maxnumber = 4 };
enum { eOas_inertials3_boardinfos_maxnumber = 5 };
typedef struct
{ //6*4=24
{ //6*5=30
eObrd_info_t data[eOas_inertials3_boardinfos_maxnumber];
} eOas_inertial3_setof_boardinfos_t; EO_VERIFYsizeof(eOas_inertial3_setof_boardinfos_t, 24)
} eOas_inertial3_setof_boardinfos_t; EO_VERIFYsizeof(eOas_inertial3_setof_boardinfos_t, 30)

typedef struct
{
Expand Down
4 changes: 3 additions & 1 deletion eth/embobj/plus/comm-v2/icub/EoBoards.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ static const uint64_t s_eoboards_is_can_mask = (0x1LL << eobrd_mc4) |
(0x1LL << eobrd_psc) |
(0x1LL << eobrd_mtb4w) |
(0x1LL << eobrd_pmc) |
(0x1LL << eobrd_amcbldc);
(0x1LL << eobrd_amcbldc) |
(0x1LL << eobrd_mtb4c);


static const eOmap_str_str_u08_t s_eoboards_map_of_boards[] =
Expand Down Expand Up @@ -121,6 +122,7 @@ static const eOmap_str_str_u08_t s_eoboards_map_of_boards[] =
{"mtb4w", "eobrd_mtb4w", eobrd_mtb4w},
{"pmc", "eobrd_pmc", eobrd_pmc},
{"amcbldc", "eobrd_amcbldc", eobrd_amcbldc},
{"mtb4c", "eobrd_mtb4c", eobrd_mtb4c},

{"none", "eobrd_none", eobrd_none},
{"unknown", "eobrd_unknown", eobrd_unknown}
Expand Down
7 changes: 5 additions & 2 deletions eth/embobj/plus/comm-v2/icub/EoBoards.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ typedef enum
eobrd_cantype_mtb4w = ICUBCANPROTO_BOARDTYPE__MTB4W, // 16 (mtb4 for waseda university)
eobrd_cantype_pmc = ICUBCANPROTO_BOARDTYPE__PMC, // 17 (pmc = piezo motor control)
eobrd_cantype_amcbldc = ICUBCANPROTO_BOARDTYPE__AMCBLDC, // 18 (amcbldc)
eobrd_cantype_mtb4c = ICUBCANPROTO_BOARDTYPE__MTB4C, // 19 (mtb4 rev.C)

eobrd_cantype_none = 254,
eobrd_cantype_unknown = ICUBCANPROTO_BOARDTYPE__UNKNOWN // 255
} eObrd_cantype_t;

enum { eobrd_cantype_numberof = 19 };
enum { eobrd_cantype_numberof = 20 };


typedef enum
Expand Down Expand Up @@ -128,12 +130,13 @@ typedef enum
eobrd_mtb4w = eobrd_cantype_mtb4w,
eobrd_pmc = eobrd_cantype_pmc,
eobrd_amcbldc = eobrd_cantype_amcbldc,
eobrd_mtb4c = eobrd_cantype_mtb4c,

eobrd_none = 254,
eobrd_unknown = 255 // = ICUBCANPROTO_BOARDTYPE__UNKNOWN
} eObrd_type_t;

enum { eobrd_type_numberof = 23 };
enum { eobrd_type_numberof = 24 };


typedef struct
Expand Down
12 changes: 6 additions & 6 deletions eth/embobj/plus/comm-v2/icub/EoManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,17 @@ typedef struct


typedef struct
{ // 24+132=156
{ // 30+132=162
eOas_inertial3_setof_boardinfos_t setofboardinfos;
eOas_inertial3_arrayof_descriptors_t arrayofdescriptor;
} eOmn_serv_config_data_as_inertial3_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_inertial3_t, 156)
} eOmn_serv_config_data_as_inertial3_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_inertial3_t, 162)


typedef struct
{ // 12+32=44
{ // 18+32=50
eOas_temperature_setof_boardinfos_t setofboardinfos;
eOas_temperature_arrayof_descriptors_t arrayofdescriptor;
} eOmn_serv_config_data_as_temperature_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_temperature_t, 44)
} eOmn_serv_config_data_as_temperature_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_temperature_t, 50)


typedef struct
Expand All @@ -546,7 +546,7 @@ typedef struct


typedef union
{ // max(6, 6, 44, 108, 156, 8, 6, 40)
{ // max(6, 6, 44, 108, 162, 8, 6, 40)
eOmn_serv_config_data_as_mais_t mais;
eOmn_serv_config_data_as_strain_t strain;
eOmn_serv_config_data_as_temperature_t temperature;
Expand All @@ -555,7 +555,7 @@ typedef union
eOmn_serv_config_data_as_psc_t psc;
eOmn_serv_config_data_as_pos_t pos;
eOmn_serv_config_data_as_ft_t ft;
} eOmn_serv_config_data_as_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_t, 156)
} eOmn_serv_config_data_as_t; EO_VERIFYsizeof(eOmn_serv_config_data_as_t, 162)



Expand Down
2 changes: 1 addition & 1 deletion eth/embobj/plus/comm-v2/protocol/api/EoProtocolMN.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extern "C" {
// - declaration of public user-defined types -------------------------------------------------------------------------


enum { eoprot_version_mn_major = 2, eoprot_version_mn_minor = 21 };
enum { eoprot_version_mn_major = 2, eoprot_version_mn_minor = 22 };


enum { eoprot_entities_mn_numberof = eomn_entities_numberof };
Expand Down

0 comments on commit aff334e

Please sign in to comment.