loboris / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
564 stars 219 forks source link

Getting assert - trying to wrap in C++ #51

Closed dmars1972 closed 6 years ago

dmars1972 commented 6 years ago

I'm trying to build a wrapper lib around this. The demo seems to work fine, but when I attempt to compile into a class with the externs, I'm getting an assert failure. I pulled the return value and passed it to esp_err_to_name and it returned ESP_ERR_INVALID_ARG.

Since c++ doesn't like the way the demo initialized the structs, I did change them, but I'm not sure if there's something I missed.

buscfg.miso_io_num=PIN_NUM_MISO;              // set SPI MISO pin
buscfg.mosi_io_num=PIN_NUM_MOSI;              // set SPI MOSI pin
buscfg.sclk_io_num=PIN_NUM_CLK;               // set SPI CLK pin
buscfg.quadwp_io_num=-1;
buscfg.quadhd_io_num=-1;
buscfg.max_transfer_sz = 6*1024;

spi_lobo_device_interface_config_t devcfg;

devcfg.clock_speed_hz=8000000;
devcfg.mode=0;
devcfg.spics_io_num=-1;
devcfg.spics_ext_io_num=PIN_NUM_CS;
devcfg.flags=LB_SPI_DEVICE_HALFDUPLEX;

ret=spi_lobo_bus_add_device(SPI_BUS, &buscfg, &devcfg, &spi);

Any ideas?

dmars1972 commented 6 years ago

Belay that. Figured that out.
Changing the declaration to spi_lobo_device_interface_config_t devcfg = {}; fixed it. :S