63 #define PEX_NR_OF_PORTS_PER_REGISTER (8u)
66 #define PEX_DEFAULT_VALUE_ALL_1 (0xFFu)
68 #define PEX_DEFAULT_VALUE_ALL_0 (0x0u)
71 #define PEX_INPUT_PORT0_REGISTER_ADDRESS (0x0u)
73 #define PEX_OUTPUT_PORT0_REGISTER_ADDRESS (0x2u)
75 #define PEX_POL_INV_PORT0_REGISTER_ADDRESS (0x4u)
77 #define PEX_DIRECTION_PORT0_REGISTER_ADDRESS (0x6u)
81 #define PEX_PIN_POLARITY_RETAINED (0u)
82 #define PEX_PIN_POLARITY_INVERTED (1u)
87 #define PEX_PIN_DIRECTION_OUTPUT (0u)
88 #define PEX_PIN_DIRECTION_INPUT (1u)
177 uint8_t pex_i2cDataRead[2u] = {0u, 0u};
350 extern uint8_t
PEX_GetPin(uint8_t portExpander, uint8_t pin) {
354 uint8_t pinState = UINT8_MAX;
366 if (pinState == 0u) {
368 }
else if (pinState == 1u) {
441 #ifdef UNITY_UNIT_TEST
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
STD_RETURN_TYPE_e I2C_Write(uint32_t slaveAddress, uint8_t writeAddress, uint32_t nrBytes, uint8_t *writeData)
writes to an I2C slave, blocking.
STD_RETURN_TYPE_e I2C_Read(uint32_t slaveAddress, uint8_t readAddress, uint32_t nrBytes, uint8_t *readData)
reads from an I2C slave, blocking.
Header for the driver for the I2C module.
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
static uint8_t pex_configPolarityPort0[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_PIN_POLARITY_RETAINED
static uint8_t pex_i2cDataWrite[2u]
static uint8_t pex_inputPort1Local[PEX_NR_OF_PORT_EXPANDERS]
static STD_RETURN_TYPE_e PEX_WriteConfigPolarity(void)
sets polarity inversion state of port expander pins over I2C.
static uint8_t pex_configDirectionPort1Local[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_PIN_POLARITY_INVERTED
static uint8_t pex_inputPort1[PEX_NR_OF_PORT_EXPANDERS]
static uint8_t pex_inputPort0[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_DIRECTION_PORT0_REGISTER_ADDRESS
static void PEX_CopyToLocalVariable(void)
copies values from the externally available variables to the local ones.
static STD_RETURN_TYPE_e PEX_WriteConfigDirection(void)
sets direction of port expander pins over I2C.
static uint8_t pex_outputPort1[PEX_NR_OF_PORT_EXPANDERS]
static void PEX_GetFromLocalVariable(void)
copies values from the local variables to the externally available ones.
uint8_t PEX_GetPin(uint8_t portExpander, uint8_t pin)
get pin state of port expander pins.
static uint8_t pex_configDirectionPort0[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_PIN_DIRECTION_INPUT
static uint8_t pex_configPolarityPort1[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_PIN_DIRECTION_OUTPUT
void PEX_SetPin(uint8_t portExpander, uint8_t pin)
sets pin to high.
void PEX_ResetPin(uint8_t portExpander, uint8_t pin)
sets pin to low.
#define PEX_DEFAULT_VALUE_ALL_1
static uint8_t pex_configDirectionPort1[PEX_NR_OF_PORT_EXPANDERS]
void PEX_SetPinPolarityRetained(uint8_t portExpander, uint8_t pin)
sets pin polarity to retained.
void PEX_SetPinDirectionOutput(uint8_t portExpander, uint8_t pin)
sets pin to input.
#define PEX_POL_INV_PORT0_REGISTER_ADDRESS
void PEX_SetPinPolarityInverted(uint8_t portExpander, uint8_t pin)
sets pin polarity to inverted.
static STD_RETURN_TYPE_e PEX_WriteOutputs(void)
sets output state of port expander pins over I2C.
static uint8_t pex_configPolarityPort0Local[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_NR_OF_PORTS_PER_REGISTER
void PEX_Initialize(void)
initialize local variable containing state of port expander.
static uint8_t pex_outputPort1Local[PEX_NR_OF_PORT_EXPANDERS]
static uint8_t pex_outputPort0[PEX_NR_OF_PORT_EXPANDERS]
static uint8_t pex_outputPort0Local[PEX_NR_OF_PORT_EXPANDERS]
void PEX_SetPinDirectionInput(uint8_t portExpander, uint8_t pin)
sets pin direction to input.
#define PEX_OUTPUT_PORT0_REGISTER_ADDRESS
#define PEX_INPUT_PORT0_REGISTER_ADDRESS
static uint8_t pex_inputPort0Local[PEX_NR_OF_PORT_EXPANDERS]
static uint8_t pex_configDirectionPort0Local[PEX_NR_OF_PORT_EXPANDERS]
static uint8_t pex_configPolarityPort1Local[PEX_NR_OF_PORT_EXPANDERS]
void PEX_Trigger(void)
implements reading/writing to the port expander registers.
#define PEX_DEFAULT_VALUE_ALL_0
static STD_RETURN_TYPE_e PEX_ReadInputs(void)
reads input state of port expander pins over I2C.
Header for the driver for the NXP PCA9539 port expander module.
const uint8_t pex_addressList[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_NR_OF_PORT_EXPANDERS