User Tools

Site Tools


esp32:direct_pin_data_copy

This is an old revision of the document!


copy data from input pin to output pin - example ws8212 data stream

void loop() {
  int v1 = 0;
  portDISABLE_INTERRUPTS();
  for(;;) {
    auto v1 = (GPIO_REG_READ(GPIO_IN_REG) & BIT(25));
    if (v1) {
       GPIO_REG_WRITE(GPIO_OUT_W1TS_REG, BIT(27)); 
       //cnt3 = 0;
    }
    else { 
      GPIO_REG_WRITE(GPIO_OUT_W1TC_REG, BIT(27)); 
      //cnt3 ++;
    }
    cnt3 ++;
    if (cnt3 % 1000000 == 0) {
      //Serial.println("loop");
      portENABLE_INTERRUPTS();
      vTaskDelay(10);
      portDISABLE_INTERRUPTS();
    }    
  }
}
esp32/direct_pin_data_copy.1569558219.txt.gz · Last modified: by aistis