feat: generic I2C and PCA95xx driver (#5233)

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
Raphael Coeffic
2024-07-06 21:45:41 +10:00
committed by GitHub
co-authored by Peter Feerick
parent 08c90dc39c
commit b71d2a0228
18 changed files with 546 additions and 359 deletions
@@ -19,16 +19,17 @@
* GNU General Public License for more details.
*/
#include <stdint.h>
#include "gyro.h"
#include "hal.h"
#if defined(IMU_I2C_BUS) && defined(IMU_I2C_ADDRESS)
#include "hal/i2c_driver.h"
#include "stm32_i2c_driver.h"
#include "delays_driver.h"
#include "hal.h"
#include <string.h>
#include <stdint.h>
/* COMMON VALUES FOR ACCEL-GYRO SENSORS */
#define LSM6DS_WHO_AM_I 0x0f
@@ -246,7 +247,7 @@ static int I2C_LSM6DS_ReadRegister(uint8_t reg)
int gyroInit()
{
if (stm32_i2c_init(IMU_I2C_BUS, IMU_I2C_CLK_RATE) < 0)
if (i2c_init(IMU_I2C_BUS) < 0)
return -1;
// LSM6DS33TR works with LSM6DSLTR code for our use