66 #define PEX_I2C_INTERFACE (i2cREG1)
69 #define PEX_NR_OF_PORTS_PER_REGISTER (8u)
72 #define PEX_DEFAULT_VALUE_ALL_1 (0xFFu)
74 #define PEX_DEFAULT_VALUE_ALL_0 (0x0u)
77 #define PEX_INPUT_PORT0_REGISTER_ADDRESS (0x0u)
79 #define PEX_OUTPUT_PORT0_REGISTER_ADDRESS (0x2u)
81 #define PEX_POL_INV_PORT0_REGISTER_ADDRESS (0x4u)
83 #define PEX_DIRECTION_PORT0_REGISTER_ADDRESS (0x6u)
87 #define PEX_PIN_POLARITY_RETAINED (0u)
88 #define PEX_PIN_POLARITY_INVERTED (1u)
93 #define PEX_PIN_DIRECTION_OUTPUT (0u)
94 #define PEX_PIN_DIRECTION_INPUT (1u)
99 #pragma SET_DATA_SECTION(".sharedRAM")
102 #pragma SET_DATA_SECTION()
366 extern uint8_t
PEX_GetPin(uint8_t portExpander, uint8_t pin) {
370 uint8_t pinState = UINT8_MAX;
382 if (pinState == 0u) {
384 }
else if (pinState == 1u) {
457 #ifdef UNITY_UNIT_TEST
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, 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.
STD_RETURN_TYPE_e I2C_WriteReadDma(i2cBASE_t *pI2cInterface, uint32_t slaveAddress, uint32_t nrBytesWrite, uint8_t *writeData, uint32_t nrBytesRead, uint8_t *readData)
reads from an I2C slave, using DMA.
STD_RETURN_TYPE_e I2C_WriteDma(i2cBASE_t *pI2cInterface, uint32_t slaveAddress, uint32_t nrBytes, uint8_t *writeData)
writes to an I2C slave, no register address written first, using DMA.
Header for the driver for the I2C module.
Declaration of the OS wrapper interface.
void OS_DelayTaskUntil(uint32_t *pPreviousWakeTime, uint32_t milliseconds)
Delay a task until a specified time.
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.
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.
static uint8_t pex_configPolarityPort0[PEX_NR_OF_PORT_EXPANDERS]
#define PEX_PIN_POLARITY_RETAINED
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_i2cDataWrite[3u]
#define PEX_I2C_INTERFACE
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_i2cDataRead[2u]
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