2023-10-13 01:41 PM - edited 2023-10-13 01:55 PM
I am looking to interface with a sths34pf80 on a nucleo-f401re. I want to set up I2C to R/W to the registers and use the included functions.
BSP_I2C1_Init();
uint8_t ret=0;
STHS34PF80_Object_t pObj;
STHS34PF80_IO_t pIO;
STHS34PF80_Init(&pObj);
STHS34PF80_RegisterBusIO(&pObj, &pIO);
if(STHS34PF80_ReadID(&pObj, &ret)==0){
//check status
}
I have tried this above using the functions in sths34pf80.c/sths34pf80.h. Have not been able to get this to work. Any suggestions?
Thanks
2023-10-16 04:15 AM
Hello @jkutteh ,
Did you try the HAL functions like HAL_I2C_Mem_Read/Write directly?
And make sure that you are setting the correct address.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-10-16 06:24 AM
Hello @Foued_KH,
I did try the HAL functions and they work. I was looking to use the sths34pf80.h libraries so I can call functions like STHS34PF80_GetPresenceFlag.
2023-10-17 02:58 AM
Hi @jkutteh ,
Have you already looked at our PID examples on GitHub?
If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.