File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ static void ss_i2c_err(uint32_t dev_id)
4949}
5050
5151static int wait_rx_or_err (bool no_stop ){
52- uint64_t timeout = TIMEOUT_MS ;
52+ uint64_t timeout = TIMEOUT_MS * 20 ;
5353 while (timeout -- ) {
5454 if (i2c_err_detect ) {
5555 if (i2c_err_source & I2C_ABRT_7B_ADDR_NOACK )
@@ -70,7 +70,7 @@ static int wait_rx_or_err(bool no_stop){
7070 return I2C_OK ;
7171 }
7272 }
73- delay ( 1 );
73+ delayMicroseconds ( 50 );
7474 }
7575 if (!no_stop )
7676 return I2C_TIMEOUT ;
@@ -79,7 +79,7 @@ static int wait_rx_or_err(bool no_stop){
7979}
8080
8181static int wait_tx_or_err (bool no_stop ){
82- uint64_t timeout = TIMEOUT_MS ;
82+ uint64_t timeout = TIMEOUT_MS * 20 ;
8383 while (timeout -- ) {
8484 if (i2c_err_detect ) {
8585 if (i2c_err_source & I2C_ABRT_7B_ADDR_NOACK )
@@ -100,7 +100,7 @@ static int wait_tx_or_err(bool no_stop){
100100 return I2C_OK ;
101101 }
102102 }
103- delay ( 1 );
103+ delayMicroseconds ( 50 );
104104 }
105105 if (!no_stop )
106106 return I2C_TIMEOUT ;
@@ -109,15 +109,15 @@ static int wait_tx_or_err(bool no_stop){
109109}
110110
111111static int wait_dev_ready (I2C_CONTROLLER controller_id , bool no_stop ){
112- uint64_t timeout = TIMEOUT_MS ;
112+ uint64_t timeout = TIMEOUT_MS * 20 ;
113113 int ret = 0 ;
114114 while (timeout -- ) {
115115 ret = ss_i2c_status (controller_id , no_stop );
116116 if (ret == I2C_OK ) {
117117 return I2C_OK ;
118118 }
119119 if (ret == I2C_BUSY ) {
120- delay ( 1 );
120+ delayMicroseconds ( 50 );
121121 }
122122 }
123123 return I2C_TIMEOUT - ret ;
You can’t perform that action at this time.
0 commit comments