-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add support for Raspberry Pi Pico - Pull Request #116
Comments
One workaround I forgot to mention regarding the SPI hardware: The Rapsberry Pi Pico has 2 SPI hardware peripherals ( I have therefore introduced the following snippet of the
Maybe not the most elegant solution ... but I did not know how to do it otherwise. |
Hi @simon-77 |
I have managed to tackle the i2c implementation, I used the arduino-pico wire code from: |
Hi @gaby64 It's great that you want to add I2C support for the Pi Pico and I would like to help you by pointing your attention to the right files.
So have a look at the I2C HAL implementation for Arduino: https://github.com/lexus2k/lcdgfx/tree/master/src/lcd_hal/arduino 2 more remarks:
If you have more questions or stumble across compile errors, feel free to ask again. |
I managed to get it to work, I placed all the code inside pico_i2c.cpp so there is no dependence on another library. I had updated my post an hour after I posted it. |
Excellent, well done 👍 😄 If you have the changes in a forked repo on github (like you had with your first attempt), you can issue a pull-request to contribute this work to this project. Cheers, Simon |
I feel like its too jank to make a pull request, Ill leave it here for someone more experienced to make a proper implementation. I changed some other files because nanoengine was not working for both spi and i2c, pgmReadByte needed to be lcd_pgmReadByte so the platform specific one can be used. |
The library lcdgfx has a long list of supported platforms, but it still lacks support for the Raspberry Pi Pico micro controller using the pico C/C++ SDK.
I have implemented some of the
lcd_hal
functions using the pico-sdk, especially for the SPI implementation and also verified this implementation using hardware.Implementation
lcdgfx/src/lcd_hal/pico/
PICO_BOARD
is used, which is defined when compiling for the Raspberry Pi Pico and can be used to distinguish between the two boardspico
andpico_w
(no difference between these boards is made here)#warning "I2C is not implemented for Pico board - this is a dummy"
LCD_PROGMEM
macro for data stored in flash. (e.g.const PROGMEM uint8_t heartImage[8]
). The pico-sdk uses the__in_flash()
macro after type definition like:const uint8_t __in_flash() heartImage[8]
.It is therefore unfortunately not possible to use the
LCD_PROGMEM
macro only using precompiler directives. I have defined theLCD_PROGMEM
"blank" to be able to compile this library.Using this library
As the Raspberry Pi Pico suite also uses CMake (and ninja) for the projects, it is fairly straight forward to "include" the source of this library (at least once I figured it out correctly).
I have provided an example with 4 additional statements in the CMakeList.txt of the Raspberry Pi Pico project to include the lcdgfx CMake folder, as well as to compile and link it correctly. Using the lcdgfx library does work the same as on the Arduino platform.
With this approach none additional compile or link process is required, as it is seemingly implemented into the CMake build process of the Raspberry Pi Pico prject.
Best regards
Simon
The text was updated successfully, but these errors were encountered: