Compiler error: one_isr() causes a section type conflict with another_isr()

titipc
Posts: 1
Joined: Wed Dec 04, 2019 9:53 pm

Compiler error: one_isr() causes a section type conflict with another_isr()

Postby titipc » Wed Dec 04, 2019 10:26 pm

I have a project that needs to handle GPIO and time interruptions.
By compiling the code below I get:
exit status 1
void onTimer0() causes a section type conflict with void Button::isr()

Code: Untitled.cpp Select all


#define START_BUTTON 19 // gpio19    // Ligada ao botao start (iniciar ciclo)
#define STOP_BUTTON 23 // gpio23 // Ligada ao botal stop all

#include <FunctionalInterrupt.h>
class Button
{
public:
Button(uint8_t reqPin) : PIN(reqPin) {
pinMode(PIN, INPUT_PULLUP);
attachInterrupt(PIN, std::bind(&Button::isr, this), FALLING);
};
~Button() {
detachInterrupt(PIN);
}
void IRAM_ATTR isr() {
//numberKeyPresses += 1;
pressed = true;
}
bool checkPressed() {
bool lastPressed;
lastPressed = this->pressed;
this->pressed = false;
return lastPressed;
}
private:
const uint8_t PIN;
//volatile uint32_t numberKeyPresses;
volatile bool pressed;

};
Button start_button(START_BUTTON);
Button stop_button(STOP_BUTTON);

#define LedI 2 // Esp32 Pin Led
byte ledI_flash=0; // Internal led flash control

hw_timer_t * timer0 = NULL; // timer to flash

void IRAM_ATTR onTimer0(){
if (ledI_flash) digitalWrite(LedI, digitalRead(LedI) ^ 1); // toggle LED pin
}

void setup() {
// Setup timer
timer0 = timerBegin(0, 24000, true); //timerID 0, div 80
timerAttachInterrupt(timer0, &onTimer0, true);
timerAlarmWrite(timer0, 5000, true);
timerAlarmEnable(timer0); // enable timer
// start flashing
ledI_flash=1;
}

void loop() {
// put your main code here, to run repeatedly:
if (start_button.checkPressed()) ledI_flash=1;
if (stop_button.checkPressed()) ledI_flash=0;
}
If i remove IRAM_ATTR from one or both isr statements I succeed in compiling.

I'm using Arduino 1.8.9 and appreciate any help understanding the cause and solution.
Thanks,
Tiberio

Who is online

Users browsing this forum: No registered users and 0 guests