mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
xtensa/esp32: Make the semaphore timeout on I2C configurable
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
committed by
saramonteiro
parent
3b2aea204c
commit
b33ccd01cf
@@ -728,6 +728,14 @@ config ESP32_I2C1_SDAPIN
|
|||||||
|
|
||||||
endif # ESP32_I2C1
|
endif # ESP32_I2C1
|
||||||
|
|
||||||
|
config ESP32_I2CTIMEOSEC
|
||||||
|
int "Timeout seconds"
|
||||||
|
default 0
|
||||||
|
|
||||||
|
config ESP32_I2CTIMEOMS
|
||||||
|
int "Timeout milliseconds"
|
||||||
|
default 500
|
||||||
|
|
||||||
endmenu # I2C configuration
|
endmenu # I2C configuration
|
||||||
|
|
||||||
menu "SPI configuration"
|
menu "SPI configuration"
|
||||||
|
|||||||
@@ -727,8 +727,18 @@ static int esp32_i2c_sem_waitdone(FAR struct esp32_i2c_priv_s *priv)
|
|||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||||
|
|
||||||
abstime.tv_sec += 10;
|
#if CONFIG_ESP32_I2CTIMEOSEC > 0
|
||||||
abstime.tv_nsec += 0;
|
abstime.tv_sec += CONFIG_ESP32_I2CTIMEOSEC;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ESP32_I2CTIMEOMS > 0
|
||||||
|
abstime.tv_nsec += CONFIG_ESP32_I2CTIMEOMS * NSEC_PER_MSEC;
|
||||||
|
if (abstime.tv_nsec >= 1000 * NSEC_PER_MSEC)
|
||||||
|
{
|
||||||
|
abstime.tv_sec++;
|
||||||
|
abstime.tv_nsec -= 1000 * NSEC_PER_MSEC;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Wait on ISR semaphore */
|
/* Wait on ISR semaphore */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user