files added
This commit is contained in:
21
cm_pcf8574_driver.c
Normal file
21
cm_pcf8574_driver.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* cm_pcf8574_driver.c
|
||||||
|
*
|
||||||
|
* Created on: 29. jan. 2024
|
||||||
|
* Author: Chris
|
||||||
|
*/
|
||||||
|
#include "cm_pcf8574_driver.h"
|
||||||
|
|
||||||
|
int cm_pcf8574_RegTransEvt(cm_pcf8574_t inst, void i2c_inst, setGet_I2C_Event_fpt i2c_transfer_evt){
|
||||||
|
|
||||||
|
if(inst == NULL) return CM_PCF8574_NOK;
|
||||||
|
|
||||||
|
inst->i2c_inst = i2c_inst;
|
||||||
|
inst->i2c_transfer_evt = i2c_transfer_evt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return CM_PCF8574_OK;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
44
cm_pcf8574_driver.h
Normal file
44
cm_pcf8574_driver.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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_ */
|
||||||
Reference in New Issue
Block a user