I am trying to use the Adafruit OLED 1.5” 1431 with the Photon.
Development is local with the CLI and the following libraries:
The graphics demo works perfect.
When I try to use the SD card I get the following errors …
bmp.cpp:30:17: error: 'File' was not declared in this scope
uint16_t read16(File f);
bmp.cpp:31:17: error: 'File' was not declared in this scope
uint32_t read32(File f);
Also …
bmp.cpp:133:20: error: 'read16' cannot be used as a function
bmp.cpp:134:63: error: 'read32' cannot be used as a function
bmp.cpp:220:23: error: 'uint16_t read16(File)' redeclared as different kind of symbol
bmp.cpp:30:10: error: previous declaration of 'uint16_t read16'
bmp.cpp: In function 'uint32_t read32(File)':
Currently I am able to set the color of the screen (fillScreen) and then load the image from the SD card. Unfortunately drawPixel does not work anymore. The screen does not change.
I assume that the CS is still on the SD card … will try to solve this now.
Any tips on that?
I will post the full code on Github and link it here once its working …
@MikeSeeH, here is the issue - the display runs in SPI mode 3 while the SD requires SPI mode 0. These are opposing modes. The solution is to use one device with software SPI (slower) and the other with hardware SPI which I see you have done for the OLED. You may need to assign different MOSI and SCLK pins than the hardware SPI though that will need to be tested.
I am not sure what you mean. Can you explain the sequence of what works and what doesn't better?
Load the BMP file from the SD and iterate through it (debugged via serial)
What is not working:
During step 3 the code calls drawPixel but the image on the OLED does not change.
(Just to be on the safe side I always try to draw in green.)
Here is my code:
As the OLED and SD card share the MOSI and SCLK pins I am not sure I understood you correctly.
Thanks!
… and thanks for your work on the mfGFX and SSD1351 libraries!
@MikeSeeH, you may want to try drawing a few graphic primitives before doing the SD load to see if the display is responding. I have to do a bit of research in the meantime.
Hello Mike
I have the same problem with i2c128x64 oled and sd card like you. I have understand from your post that I have to use software spi for oled but my oled work with i2c protocol. So in your point of view what can I do to solve my problem? And my second question is that in this code
SD.begin(most,miso.sclk.cs_sd)
What I replace with its argument parameters?
I2C is not only a different protocol but an entirely different HW interface.
In order to instruct the library to use that instead of SPI you’ll probably need to call a different constructor or begin() overload - providing the library does support I2C, but Adafruit_SSD1351_Photon does not.