attachInterrupt not recognised

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

attachInterrupt not recognised

Postby Lancsrick » Thu May 18, 2023 9:14 am

I'm doing something very daft somewhere but I can't figure it out. Just starting to play with interrupts (ESP32, VSCode, ESP-IDF Framework, PlatformIO). I've commented my code down to the bare minimum and still get told at Build

Code: Select all

implicit declaration of function 'attachInterrupt'; did you mean 'xthal_get_interrupt'? [-Werror=implicit-function-declaration]
Code (trimmed to just what I haven't commented out):

Code: Select all

#include <inttypes.h>
#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <sys/time.h>
#include <hd44780.h>
#include <pcf8574.h>
#include <string.h>
#include "driver/gpio.h"

void IRAM_ATTR isr() {
printf("pressed");
}

void setup() {
    gpio_set_direction(GPIO_NUM_22, GPIO_MODE_INPUT);
    attachInterrupt(22, isr, RISING);
}

void lcd_test(void *pvParameters)
{
 while (1){
           
        }
}

void app_main()
{
    ESP_ERROR_CHECK(i2cdev_init());
    xTaskCreate(lcd_test, "lcd_test", configMINIMAL_STACK_SIZE * 5, NULL, 5, NULL);
}


What's the stupid error I must be making please?

Mermaja
Posts: 9
Joined: Tue Mar 28, 2023 2:21 pm

Re: attachInterrupt not recognised

Postby Mermaja » Thu May 18, 2023 1:43 pm

As far as I know, attachInterrupt is a function used in the Arduino IDE (and PlatformIO) to attach a pseudo interrupt routine to an external (GPIO triggered) interrupt. It is not a generic function and not one supported by the Espressif IDE.

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: attachInterrupt not recognised

Postby Lancsrick » Thu May 18, 2023 1:47 pm

That'll be the stupid then, thanks :).

Who is online

Users browsing this forum: Baidu [Spider], ignisuti, irahul and 92 guests