当前位置:网站首页>Esp8266 interrupt configuration

Esp8266 interrupt configuration

2022-07-05 08:29:00 Sharing master

Recently, I am working on a light sense debugging project , Polling mode can receive data normally , There are problems in configuring interrupt mode ,

Initialize the configuration of intermediate configuration

  pinMode(SensorINPUT, INPUT_PULLUP); 
 // attachInterrupt(D7, mn78xxx_setup_eint, CHANGE);
  attachInterrupt(digitalPinToInterrupt(SensorINPUT),mn78xxx_setup_eint, FALLING); // Open encoder 
  Serial.println("init int done ");

Interrupt handling function

//ICACHE_RAM_ATTR void mn78xxx_setup_eint()
void mn78xxx_setup_eint()
{
  alsps_int_flag == true;
}

 

  1. The function in must have no parameters and no return value .
  2. Because interruption will interrupt the normal operation of code , therefore ISR Should be implemented as soon as possible .
  3. stay ISR You cannot use other functions implemented with interrupts , Such as millis() delay()  etc. . The delay can be used   delayMicroseconds(), It is not implemented with interrupts .
  4. Interrupt trigger condition , There are several optional values :
    LOW  When the interrupt is Pin Trigger when the mouth is at low level
    CHANGE  When the interrupt is Pin Triggered when the port level changes
    RISING  When the interrupt is Pin The port changes from low level to high level ( Rising edge ) Trigger when
    FALLING  When the interrupt is Pin The port changes from high level to low level ( Falling edge ) Trigger when
原网站

版权声明
本文为[Sharing master]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140544213628.html