2024-04-03 11:03 AM - last edited on 2024-04-04 06:08 AM by Amel NASRI
Hello everyone, I am working with the STM32F411E and i am trying to make the LSM303DLHC working on my board. At this moment i am using this lib: https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/BSP/Components/lsm303dlhc/lsm303dlhc.c
The problem i am having is that it cant find accelero.c to understand the GetXYZ function code in the code AccelerometerDrv->GetXYZ(pDataXYZ);
Solved! Go to Solution.
2024-05-22 02:45 AM
Hello @ThienNguyen0301 ,
In the accelero.h header file, we define a structure ACCELERO_DrvTypeDef. This structure includes a function pointer GetXYZ that is meant to point to a function which retrieves the x, y, and z acceleration data from the accelerometer.
In the Lsm303dhlc.c source file, we have the implementation of the function LSM303DLHC_AccReadXYZ . This function is specifically written to interact with the hardware to retrieve the accelerometer data.
The GetXYZ function pointer in the ACCELERO_DrvTypeDef structure is set to point to LSM303DLHC_AccReadXYZ. This means that when we call AccelerometerDrv->GetXYZ(pDataXYZ) in the code, it's actually calling the LSM303DLHC_AccReadXYZ function, which will execute and provide us with the accelerometer data.
If this solves your problem, please mark my answer as "Best Answer" by clicking on the "Select as Best" button, this can be helpful for Community users to find this solution faster.
Thank you
BeST regards
MB
2024-05-22 02:45 AM
Hello @ThienNguyen0301 ,
In the accelero.h header file, we define a structure ACCELERO_DrvTypeDef. This structure includes a function pointer GetXYZ that is meant to point to a function which retrieves the x, y, and z acceleration data from the accelerometer.
In the Lsm303dhlc.c source file, we have the implementation of the function LSM303DLHC_AccReadXYZ . This function is specifically written to interact with the hardware to retrieve the accelerometer data.
The GetXYZ function pointer in the ACCELERO_DrvTypeDef structure is set to point to LSM303DLHC_AccReadXYZ. This means that when we call AccelerometerDrv->GetXYZ(pDataXYZ) in the code, it's actually calling the LSM303DLHC_AccReadXYZ function, which will execute and provide us with the accelerometer data.
If this solves your problem, please mark my answer as "Best Answer" by clicking on the "Select as Best" button, this can be helpful for Community users to find this solution faster.
Thank you
BeST regards
MB