User Tools

Site Tools


esp32:direct_pin_data_copy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
esp32:direct_pin_data_copy [2019/09/27 07:26] – aistisesp32:direct_pin_data_copy [2019/09/27 07:34] (current) – aistis
Line 26: Line 26:
   }   }
 } }
 +</code>
 +
 +
 +speed is like 3.5 times faster
 +
 +  * 07:31:40.620 -> register based read : 53
 +  * 07:31:40.620 -> digitalRead based read : 172
 +
 +<code>
 +  auto t1 = micros();
 +  int v1;
 +  for (int i=0;i<1000;i++)
 +    v1 = (GPIO_REG_READ(GPIO_IN_REG) & BIT(25));
 +  auto t2 = micros();
 +  auto t3 = micros();
 +  for (int i=0;i<1000;i++)
 +    v1 = digitalRead(25);
 +  auto t4 = micros();
 +  Serial.printf("register based read : %d\n",t2-t1);
 +  Serial.printf("digitalRead based read : %d\n",t4-t3);  
 </code> </code>
esp32/direct_pin_data_copy.1569558380.txt.gz · Last modified: by aistis