In EB tresos 20.1, there is an option named PORT_PIN_INOUT of PortPin Direction configuration. What is it used for?
I supposed this option shall be used in an application where the port direction needs to change regularly, such as SDA pin of I2C, and you needn't call Port_SetPinDirection() in the run time. But this can't work as I thought.
So what exactly is this PORT_PIN_INOUT used for?
Dear Lambert Yang,
From my point of view, the PORT_PIN_INOUT used for setting up the pin need both in/out (EG: I2c_SDA) as you say.
Hi Hung,
In I2C slave response phase, the master first writes high on SDA and checks if SDA is pulled low by the slave. If call Dio_WriteChannel(DioConf_DioChannel_I2C_SDA, STD_ON) first and then call Dio_ReadChannel(DioConf_DioChannel_I2C_SDA), the result will always be high regardless of the fact the slave has responded . So I wonder whether the MCAL driver doesn't function well or I made stupid mistakes.
Hi Lambert,
From my point of view, if you want to use GPIO bit-bang to write I2C driver, we need to call Port_SetPinDirection() in the run time. Eg: after master note send data, it need to change the pin to "input" to release the bus.
The "PORT_IN_OUT" is used in case we use the I2c hardware(Eg: flexIO I2c) or data pin of module uSDHC,...
Good answer! I got it. Thank you Hung.