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

Using GPIO Lookup Macros with ESP-IDF V5 (IDFGH-9105) #10508

Closed
3 tasks done
nopnop2002 opened this issue Jan 9, 2023 · 8 comments
Closed
3 tasks done

Using GPIO Lookup Macros with ESP-IDF V5 (IDFGH-9105) #10508

nopnop2002 opened this issue Jan 9, 2023 · 8 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@nopnop2002
Copy link

nopnop2002 commented Jan 9, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I used the GPIO Lookup Macros below:
ADC1_GPIO32_CHANNEL

But I get the following warning:

In file included from ../main/main.c:11:
/home/nop/esp-idf/components/driver/deprecated/driver/adc.h:19:2: warning: #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively" [-Wcpp]
   19 | #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively"
      |  ^~~~~~~

IDF Version:

$ idf.py --version
ESP-IDF v5.0

Source code:

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "soc/adc_channel.h"
#include "driver/adc.h"

#define TAG "MAIN"

void app_main()
{
        ESP_LOGI(TAG, "ADC1_GPIO32_CHANNEL=%d", ADC1_GPIO32_CHANNEL);
}

macros:

ADC1_GPIO32_CHANNEL are defined in soc/adc_channel.h.

#define ADC1_GPIO32_CHANNEL     ADC1_CHANNEL_4

ADC1_CHANNEL_4 are defined in driver/deprecated/driver/adc_types_legacy.h.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 9, 2023
@github-actions github-actions bot changed the title Using GPIO Lookup Macros with ESP-IDF V5 Using GPIO Lookup Macros with ESP-IDF V5 (IDFGH-9105) Jan 9, 2023
@Icarus113
Copy link
Collaborator

Hi @nopnop2002 , the ADC related drivers under driver/adc.h include path are migrated to esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h. Detailed migration guides are here. You can enable CONFIG_ADC_SUPPRESS_DEPRECATE_WARN to disable the deprecation warning, if you still use the legacy driver.

@nopnop2002
Copy link
Author

nopnop2002 commented Jan 9, 2023

@Icarus113
Thanks for your comment.
I have read this but could not find any mention of ADC1_GPIOxx_CHANNEL.

This document has the following descriptions:

The ADC oneshot mode driver has been redesigned.
The new driver is in esp_adc component and the include path is esp_adc/adc_oneshot.h.
The legacy driver is still available in the previous include path driver/adc.h.
The ADC continuous mode driver has been moved from driver component to esp_adc component.
The include path has been changed from driver/adc.h to esp_adc/adc_continuous.h.

But ADC1_GPIOxx_CHANNEL is not defined in "esp_adc/adc_continuous.h" nor "esp_adc/adc_oneshot.h".
When using ADC1_GPIO32_CHANNEL, it looks like I still need to use the legacy driver.

I'm looking for a way I can use ADC1_GPIOxx_CHANNEL without using driver/adc.h .

@Icarus113
Copy link
Collaborator

I see, thanks for the report. Since ADC1_GPIOxx_CHANNEL isn't deprecated, we will make them work with both the legacy driver and the new driver. @nopnop2002
There will be a commit for this later.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Jan 9, 2023
@nopnop2002
Copy link
Author

@Icarus113

This document may also need revision.
GPIO_Lookup_Macros

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Jan 12, 2023
@Icarus113
Copy link
Collaborator

The doc you posted seems to be a version earlier than v5.0. So it should be correct. The fix has been merged, and will be introduced in next v5.0.x release as well.
@nopnop2002

@nopnop2002
Copy link
Author

nopnop2002 commented Jan 12, 2023

@Icarus113

The doc you posted seems to be a version earlier than v5.0.

See bottom left of my posted image.

It is written as v:latest.
GPIO_Lookup_Macros

@Icarus113
Copy link
Collaborator

Icarus113 commented Jan 12, 2023

Maybe it's because what your posted is in the readthedocs ? Sorry I'm not quite sure of the one you posted. But I'm sure the adc.html is the old one (prior to v5.0).
I think you can refer to This

@nopnop2002

@nopnop2002
Copy link
Author

nopnop2002 commented Jan 12, 2023

@Icarus113

Maybe it's because what your posted is in the readthedocs?

Yes.
my post is readthedocs.

https://espressif-docs.readthedocs-hosted.com/projects/esp-idf/en/latest/api-reference/peripherals/adc.html#gpio-lookup-macros

This is probably not the latest version.

Sorry for confusing you.

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

3 participants