Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'GPIO' undeclared using esp-idf ver5 (IDFGH-7631) #9184

Closed
nopnop2002 opened this issue Jun 19, 2022 · 4 comments
Closed

'GPIO' undeclared using esp-idf ver5 (IDFGH-7631) #9184

nopnop2002 opened this issue Jun 19, 2022 · 4 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@nopnop2002
Copy link

Environment

$ idf.py --version
ESP-IDF v5.0-dev-3202-ga2d5041492-dirty

Problem Description

'GPIO' undeclared using esp-idf ver5

Code to reproduce this issue

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "driver/gpio.h"
#include "esp_log.h"

#define GPIO_PIN 2

#define TAG "MAIN"

void app_main()
{
  gpio_reset_pin( GPIO_PIN );
  gpio_set_direction( GPIO_PIN, GPIO_MODE_OUTPUT );
  gpio_set_level( GPIO_PIN, 0 );

  gpio_set_level( GPIO_PIN, 1 );
  vTaskDelay(100);
  gpio_set_level( GPIO_PIN, 0 );
  vTaskDelay(100);

  GPIO.out_w1ts = (1 << GPIO_PIN);
  vTaskDelay(100);
  GPIO.out_w1tc = (1 << GPIO_PIN);
  vTaskDelay(100);
}

Debug Logs

../main/main.c: In function 'app_main':
../main/main.c:27:2: error: 'GPIO' undeclared (first use in this function)
  GPIO.out_w1ts = (1 << GPIO_PIN);
  ^~~~
../main/main.c:27:2: note: each undeclared identifier is reported only once for each function it appears in
[818/825] Building C object esp-idf/wi...ifi_provisioning.dir/src/manager.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jun 19, 2022
@github-actions github-actions bot changed the title 'GPIO' undeclared using esp-idf ver5 'GPIO' undeclared using esp-idf ver5 (IDFGH-7631) Jun 19, 2022
@moefear85
Copy link

I don't think there is any official GPIO struct or class exposed as part of the interface in esp-idf. So even if such a structure existed in previous versions, this is subject to change across major version changes

@nopnop2002
Copy link
Author

nopnop2002 commented Jun 19, 2022

@moefear85

It's a shame that we can't use the GPIO class because we can do IO about 6 times faster.

@ESP-Marius
Copy link
Collaborator

Hi,

As @moefear85 mentions, the GPIO struct was never intended to be a part of the public interface of gpio.h, but previously it might have been exposed indirectly through some of the header includes.

If you want to use it you can still include hal/gpio_ll.h, which exposes this struct, as well as functions for accessing it.

Note that the HAL layer is not part of the stable API, so updates might contain breaking changes, even between non-major version updates of IDF.

@nopnop2002
Copy link
Author

Thank you for your quick answer.
It worked with Ver5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants