From c526b7c568a803af3d14fdf827851e3eafeb972a Mon Sep 17 00:00:00 2001 From: Ruben Noroian Date: Sun, 10 Nov 2024 17:05:38 -0500 Subject: [PATCH] removing the i2c_handler, preping for cerb changes --- general/include/pca9539.h | 10 +++++----- general/src/pca9539.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/general/include/pca9539.h b/general/include/pca9539.h index bbd6878..a75fde2 100644 --- a/general/include/pca9539.h +++ b/general/include/pca9539.h @@ -38,16 +38,16 @@ PCA 9539 16 bit GPIO expander. Datasheet: https://www.ti.com/lit/ds/symlink/pca //return HAL_I2C_Mem_Write(pca->i2c_handle, pca->dev_addr, address, //I2C_MEMADD_SIZE_8BIT, data, 1, HAL_MAX_DELAY); -typedef int (*WritePtr)(void *handler, uint16_t dev_addr, uint16_t mem_address, +typedef int (*WritePtr)(uint16_t dev_addr, uint16_t mem_address, uint16_t mem_add_size, uint8_t *data, uint16_t size, int delay); -typedef int (*ReadPtr)(void *handler, uint16_t dev_addr, uint16_t mem_address, +typedef int (*ReadPtr)(uint16_t dev_addr, uint16_t mem_address, uint16_t mem_add_size, uint8_t *data, uint16_t size, int delay); typedef struct { //int i2c_handler; - void *i2c_handler; + //void *i2c_handler; //I2C_HandleTypeDef *i2c_handle; WritePtr write; @@ -56,8 +56,8 @@ typedef struct { uint16_t dev_addr; } pca9539_t; -void pca9539_init(pca9539_t *pca, void *i2c_handler, WritePtr writeFunc, - ReadPtr readFunc, uint8_t dev_addr); +void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, + uint8_t dev_addr); int pca9539_read_reg(pca9539_t *pca, uint8_t reg_type, uint8_t *buf); diff --git a/general/src/pca9539.c b/general/src/pca9539.c index 42810ca..8fb578f 100644 --- a/general/src/pca9539.c +++ b/general/src/pca9539.c @@ -12,8 +12,8 @@ int pca_write_reg(pca9539_t *pca, uint16_t address, uint8_t *data) uint16_t data_size = 1; int delay = 0xFFFFFFFFU; - return pca->write(pca->i2c_handler, pca->dev_addr, address, - mem_add_size, data, data_size, delay); + return pca->write(pca->dev_addr, address, mem_add_size, data, data_size, + delay); } /*IGNORE THIS CODE - LEFT AS A REFERENCE @@ -30,8 +30,8 @@ int pca_read_reg(pca9539_t *pca, uint16_t address, uint8_t *data) uint16_t data_size = 1; int delay = 0xFFFFFFFFU; - return pca->read(pca->i2c_handler, pca->dev_addr, address, mem_add_size, - data, data_size, delay); + return pca->read(pca->dev_addr, address, mem_add_size, data, data_size, + delay); } /* IGNORE THIS CODE - LEFT AS A REFERENCE @@ -43,10 +43,10 @@ HAL_StatusTypeDef pca_read_reg(pca9539_t* pca, uint16_t address, uint8_t* data) }*/ //Intializes the struct -void pca9539_init(pca9539_t *pca, void *i2c_handler, WritePtr writeFunc, - ReadPtr readFunc, uint8_t dev_addr) +void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, + uint8_t dev_addr) { - pca->i2c_handler = i2c_handler; + //pca->i2c_handler = i2c_handler; pca->dev_addr = dev_addr << 1u; pca->write = writeFunc;