File tree 1 file changed +6
-6
lines changed
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)
49
49
}
50
50
51
51
static int wait_rx_or_err (bool no_stop ){
52
- uint64_t timeout = TIMEOUT_MS ;
52
+ uint64_t timeout = TIMEOUT_MS * 20 ;
53
53
while (timeout -- ) {
54
54
if (i2c_err_detect ) {
55
55
if (i2c_err_source & I2C_ABRT_7B_ADDR_NOACK )
@@ -70,7 +70,7 @@ static int wait_rx_or_err(bool no_stop){
70
70
return I2C_OK ;
71
71
}
72
72
}
73
- delay ( 1 );
73
+ delayMicroseconds ( 50 );
74
74
}
75
75
if (!no_stop )
76
76
return I2C_TIMEOUT ;
@@ -79,7 +79,7 @@ static int wait_rx_or_err(bool no_stop){
79
79
}
80
80
81
81
static int wait_tx_or_err (bool no_stop ){
82
- uint64_t timeout = TIMEOUT_MS ;
82
+ uint64_t timeout = TIMEOUT_MS * 20 ;
83
83
while (timeout -- ) {
84
84
if (i2c_err_detect ) {
85
85
if (i2c_err_source & I2C_ABRT_7B_ADDR_NOACK )
@@ -100,7 +100,7 @@ static int wait_tx_or_err(bool no_stop){
100
100
return I2C_OK ;
101
101
}
102
102
}
103
- delay ( 1 );
103
+ delayMicroseconds ( 50 );
104
104
}
105
105
if (!no_stop )
106
106
return I2C_TIMEOUT ;
@@ -109,15 +109,15 @@ static int wait_tx_or_err(bool no_stop){
109
109
}
110
110
111
111
static int wait_dev_ready (I2C_CONTROLLER controller_id , bool no_stop ){
112
- uint64_t timeout = TIMEOUT_MS ;
112
+ uint64_t timeout = TIMEOUT_MS * 20 ;
113
113
int ret = 0 ;
114
114
while (timeout -- ) {
115
115
ret = ss_i2c_status (controller_id , no_stop );
116
116
if (ret == I2C_OK ) {
117
117
return I2C_OK ;
118
118
}
119
119
if (ret == I2C_BUSY ) {
120
- delay ( 1 );
120
+ delayMicroseconds ( 50 );
121
121
}
122
122
}
123
123
return I2C_TIMEOUT - ret ;
You can’t perform that action at this time.
0 commit comments