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

Compile errors on ESP IDF #170

Open
Merlinity opened this issue Mar 4, 2025 · 0 comments
Open

Compile errors on ESP IDF #170

Merlinity opened this issue Mar 4, 2025 · 0 comments
Assignees
Labels

Comments

@Merlinity
Copy link

Describe the bug
When I try to build this as an Espressif component in my project, I get two errors regarding:

  • Not finding #include "driver/gpio.h"
  • portTICK_RATE_MS in esp/platform.c not being defined

To Reproduce
Steps to reproduce the behavior:

  1. Create platformio project
  2. Clone ssd1306 project into components/
  3. Build
  4. See error regarding driver/gpio.h
  5. Fix this (as described below)
  6. See error regarding portTICK_RATE_MS

Expected behavior
No build errors.

Error Messages
regarding driver/gpio.h:

Building in release mode
Compiling .pio/build/lolin_d32_pro/components/ssd1306/src/ssd1306_hal/esp/platform.c.o
components/ssd1306/src/ssd1306_hal/esp/platform.c:33:10: fatal error: driver/gpio.h: No such file or directory
   33 | #include "driver/gpio.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/lolin_d32_pro/components/ssd1306/src/ssd1306_hal/esp/platform.c.o] Error 1
================== [FAILED] Took 5.59 seconds ==================

regarding portTICK_RATE_MS:

Building in release mode
Compiling .pio/build/lolin_d32_pro/components/ssd1306/src/ssd1306_hal/esp/platform.c.o
components/ssd1306/src/ssd1306_hal/esp/platform.c: In function 'platform_i2c_stop':
components/ssd1306/src/ssd1306_hal/esp/platform.c:103:77: error: 'portTICK_RATE_MS' undeclared (first use in this function); did you mean 'portTICK_PERIOD_MS'?
  103 |     /*esp_err_t ret =*/ i2c_master_cmd_begin(s_bus_id, s_cmd_handle, 1000 / portTICK_RATE_MS);
      |                                                                             ^~~~~~~~~~~~~~~~
      |                                                                             portTICK_PERIOD_MS
components/ssd1306/src/ssd1306_hal/esp/platform.c:103:77: note: each undeclared identifier is reported only once for each function it appears in
*** [.pio/build/lolin_d32_pro/components/ssd1306/src/ssd1306_hal/esp/platform.c.o] Error 1
================================ [FAILED] Took 5.86 seconds ================================

Please complete the following information:

  • library version: 1.8.5
  • LCD display type
  • OS: linux
  • Platform: platformio : esp32
  • IDE: VSCode

Suggested fixes
The errors can be fixed by making the following edits:

In CMakeLists.txt change

idf_component_register(SRCS ${SOURCE_FILES}
                           INCLUDE_DIRS "src")

to

idf_component_register(SRCS ${SOURCE_FILES}
                       INCLUDE_DIRS "src"
                       REQUIRES driver)

In /esp/platform.c change portTICK_RATE_MS to portTICK_PERIOD_MS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants