diff --git a/general/include/pca9539.h b/general/include/pca9539.h index a0289e2..270400c 100644 --- a/general/include/pca9539.h +++ b/general/include/pca9539.h @@ -39,19 +39,19 @@ PCA 9539 16 bit GPIO expander. Datasheet: https://www.ti.com/lit/ds/symlink/pca * @brief Pointer to write function * */ -typedef uint8_t (*WritePtr)(uint16_t dev_addr, uint8_t reg, uint8_t *data, - uint8_t size); +typedef uint8_t (*PCA_Write)(uint16_t dev_addr, uint8_t reg, uint8_t *data, + uint8_t size); /** * @brief Pointer to read function * */ -typedef uint8_t (*ReadPtr)(uint16_t dev_addr, uint8_t reg, uint8_t *data, - uint8_t size); +typedef uint8_t (*PCA_Read)(uint16_t dev_addr, uint8_t reg, uint8_t *data, + uint8_t size); typedef struct { - WritePtr write; - ReadPtr read; + PCA_Write write; + PCA_Read read; uint16_t dev_addr; } pca9539_t; @@ -64,7 +64,7 @@ typedef struct { * @param readFunc function pointer to HAL specific read func * @param dev_addr i2c device address */ -void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, +void pca9539_init(pca9539_t *pca, PCA_Write writeFunc, PCA_Read readFunc, uint8_t dev_addr); /** diff --git a/general/src/pca9539.c b/general/src/pca9539.c index 289468c..dff1a1b 100644 --- a/general/src/pca9539.c +++ b/general/src/pca9539.c @@ -4,17 +4,17 @@ #define REG_SIZE_BITS 8 -int pca_write_reg(pca9539_t *pca, uint8_t address, uint8_t *data) +static int pca_write_reg(pca9539_t *pca, uint8_t address, uint8_t *data) { return pca->write(pca->dev_addr, address, data, 1); } -int pca_read_reg(pca9539_t *pca, uint8_t address, uint8_t *data) +static int pca_read_reg(pca9539_t *pca, uint8_t address, uint8_t *data) { return pca->read(pca->dev_addr, address, data, 1); } -void pca9539_init(pca9539_t *pca, WritePtr writeFunc, ReadPtr readFunc, +void pca9539_init(pca9539_t *pca, PCA_Write writeFunc, PCA_Read readFunc, uint8_t dev_addr) { pca->dev_addr = dev_addr << 1u;