Hi everyone,
I'm trying to integrate a library (BSXlite Library) into by code and I cannot understand how they pass struct pointer to function.. well this the structure
Code:
typedef struct {
BSX_U8 *accelspec;
BSX_U8 *magspec;
BSX_U8 *gyrospec;
BSX_U8 *usecase;
BSX_U8 accelspec_status;
BSX_U8 magspec_status;
BSX_U8 gyrospec_status;
BSX_U8 usecase_status;
}initParam_t;
and this is the function
Code:
BSX_S8 bsx_init(initParam_t*); // BSX_S8 is typedef of int8_t
This is Integration guideline snippet (provided by the manufacturer)
Code:
initParam_t s_input;
BSX_S8 init_status;
s_input.accelspec = str_accsensorspec;
s_input.magspec = str_magsensorspec;
s_input.gyrospec = str_gyrosensorspec;
s_input.usecase = str_config;
init_status = bsx_init(initParam_t &s_input);
I cannot understand why they pass the initParam_t &s_input into bsx_init() function.. It is like they create again the instance s_input..
It couldn't be like this?