Skip to content

Compile errors on ESP IDF #170

@Merlinity

Description

@Merlinity

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions