relevant doc are here H:\Shared drives\AuralixPrj_AuralixCCppLib\Task\ALX-202-1-TASK-3--AlxVeml6040
veml6040.pdf -> here is NOT clear what are default values of this register
seems like we want to use it in this mode settings
it would be got to support all options, relevant to init config
good reference example for unions system is alxPcal6416a
for conversion of MSB & LSB data bytes it's recommended to use Unions and NOT BIT SHIFTING!
see system for AlxAdxl355_Temp_12bit --> Here Union is used for converting 2x RAW bytes MSB & LSB to uint16_t value, something similar you will need todo..
typedef union
{
uint16_t val;
uint8_t raw[2];
} AlxAdxl355_Temp_12bit;
for Init system use same as in alxPcal6416a
// Set register struct values to default
AlxPcal6416a_RegStruct_SetValToDefault(me);
// Set register struct values - WEAK
AlxPcal6416a_RegStruct_SetVal(me);
// Write register struct - WEAK
status = AlxPcal6416a_RegStruct_Write(me);
if (status != Alx_Ok) { ALX_PCAL6416A_TRACE("Err"); return status; }
Recommended interface:
Notes
for Init system use same as in alxPcal6416a
for WEAK function implementation you can see https://github.com/auralix/nxp-9-af-10-wbd-cradle-fw