We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is updated register data structure that is a union that has a byte variable and anonymous structure:
typedef union { uint8_t buf; struct { #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN uint8_t not_used_01 : 6; uint8_t sdo_pu_en : 1; uint8_t not_used_02 : 1; #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN uint8_t not_used_02 : 1; uint8_t sdo_pu_en : 1; uint8_t not_used_01 : 6; #endif /* DRV_BYTE_ORDER */ }; } asm330lhh_pin_ctrl_t;
Since the data structure is anonymous you can still access to the structure elements like before: pin_ctrl.sdo_pu_en = 1;
pin_ctrl.sdo_pu_en = 1;
It is convenient to have an access to the register structure as a byte, when you want to set default value in the register:
asm330lhh_pin_ctrl_t pin_ctrl = {.buf = 0x3f};
also you can use buf as pointer to a register structure, and then you don't need uint8_t type cast:
uint8_t
stc_imu_data_t imu_data[] = { {ASM330LHH_REG_PIN_CTRL, &pin_ctrl.buf}, /* Here I would have all of the rest of the IMU registers, */ };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here is updated register data structure that is a union that has a byte variable and anonymous structure:
Since the data structure is anonymous you can still access to the structure elements like before:
pin_ctrl.sdo_pu_en = 1;
It is convenient to have an access to the register structure as a byte, when you want to set default value in the register:
asm330lhh_pin_ctrl_t pin_ctrl = {.buf = 0x3f};
also you can use buf as pointer to a register structure, and then you don't need
uint8_t
type cast:The text was updated successfully, but these errors were encountered: