45 lines
809 B
C
45 lines
809 B
C
/*
|
|
* cm_pcf8574_driver.h
|
|
*
|
|
* Created on: 29. jan. 2024
|
|
* Author: Chris
|
|
*/
|
|
|
|
#ifndef PCF8574_IO_EXPANDER_CM_PCF8574_DRIVER_H_
|
|
#define PCF8574_IO_EXPANDER_CM_PCF8574_DRIVER_H_
|
|
|
|
enum{
|
|
CM_PCF8574_OK = 0,
|
|
CM_PCF8574_NOK
|
|
};
|
|
|
|
typedef int (*setGet_I2C_Event_fpt)(void *inst, uint8_t *data, uint32_t len, uint8_t set_get);
|
|
|
|
|
|
typedef struct{
|
|
|
|
uint8_t B0 : 1;
|
|
uint8_t B1 : 1;
|
|
uint8_t B2 : 1;
|
|
uint8_t B3 : 1;
|
|
uint8_t B4 : 1;
|
|
uint8_t B5 : 1;
|
|
uint8_t B6 : 1;
|
|
uint8_t B7 : 1;
|
|
|
|
}cm_io_port_t;
|
|
|
|
typedef struct{
|
|
void *i2c_inst;
|
|
setGet_I2C_Event_fpt i2c_transfer_evt;
|
|
|
|
cm_io_port_t Port_1;
|
|
|
|
|
|
}cm_pcf8574_t;
|
|
|
|
int cm_pcf8574_RegTransEvt(cm_pcf8574_t inst, void i2c_inst, setGet_I2C_Event_fpt i2c_transfer_evt);
|
|
int cm_pcf8574_init(cm_pcf8574_t *inst);
|
|
|
|
#endif /* PCF8574_IO_EXPANDER_CM_PCF8574_DRIVER_H_ */
|