Files
pcf8574_driver/cm_pcf8574_driver.h
Christian L. V. Madsen a13b50e47f test
2024-08-17 13:42:34 +02:00

54 lines
955 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_
#include "stdint.h"
enum{
CM_PCF8574_OK = 0,
CM_PCF8574_NOK
};
enum{
CM_PCF8574_I2C_GET = 0,
CM_PCF8574_I2C_SET = 1,
};
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_SetPort(cm_pcf8574_t *inst, uint8_t port_val);
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_ */