polpo / rp2040-psram

A header-only C library to allow access to SPI PSRAM via PIO on the RP2040 microcontroller.
MIT License
134 stars 13 forks source link

The included example does not build #6

Closed kholia closed 1 year ago

kholia commented 1 year ago

Hi - It seems that the included example does not build.

I am using commit 36f272178abb21370a7087bf9506a055feedfd39 which is the latest.

$ git rev-parse HEAD
36f272178abb21370a7087bf9506a055feedfd39
$ pwd
rp2040-psram/examples
$ cmake .

$ make
...
rp2040-psram/examples/psram-test.c:7:1: error: unknown type name 'pio_spi_inst_t'; did you mean 'psram_spi_inst_t'?
    7 | pio_spi_inst_t psram_spi;
      | ^~~~~~~~~~~~~~
      | psram_spi_inst_t

It seems that the API has changed underneath.

Thanks for the help with this.

kholia commented 1 year ago

The following patch helps a bit:

diff --git a/examples/psram-test.c b/examples/psram-test.c
index a3e7f89..ed0b0b0 100644
--- a/examples/psram-test.c
+++ b/examples/psram-test.c
@@ -4,7 +4,7 @@
 #include <pico/stdlib.h>

 #include "psram_spi.h"
-pio_spi_inst_t psram_spi;
+psram_spi_inst_t psram_spi;

 int main()
 {
@@ -12,11 +12,11 @@ int main()
     set_sys_clock_khz(280000, true);

     stdio_init_all();
-    
+
     puts("PSRAM test - rp2040-psram v1.0.0");

     puts("Initing PSRAM...");
-    psram_spi = psram_init();
+    psram_spi = psram_spi_init(pio1, -1);

     uint32_t psram_begin, psram_elapsed;
     float psram_speed;

Edit: The API docs will also need an update.

kholia commented 1 year ago

@Sudhamsu98 Your (runtime failure) issue in unrelated to the compilation issue I reported in this thread.

Sudhamsu98 commented 1 year ago

@Sudhamsu98 Your (runtime failure) issue in unrelated to the compilation issue I reported in this thread.

Hi Kholia, Sorry about that I have removed it. I had opened a new issue, did not get any response so took a look at your forked changes still facing issues so hence I posted it. By any chance I can reach out to you, would be helpful.

Thanks