User avatar
HermannSW
Posts: 4667
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: STICKY: Community library list for Pi Pico SDK C/C++

Sat Apr 24, 2021 8:29 pm

@cleverca developed tools for including arbitrary binary file into C SDK project.

@shabtronic used it and summarized:
viewtopic.php?f=144&t=310346&p=1856196#p1856196

Please add under tools section.
https://github.com/Hermann-SW/memrun
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon Apr 26, 2021 12:52 pm

HermannSW wrote:
Sat Apr 24, 2021 8:29 pm
@cleverca developed tools for including arbitrary binary file into C SDK project.

@shabtronic used it and summarized:
viewtopic.php?f=144&t=310346&p=1856196#p1856196

Please add under tools section.
Done! Thanks for the pointer.

antgon
Posts: 2
Joined: Fri Apr 30, 2021 6:44 am
Location: Scotland

Re: STICKY: Community library list for Pi Pico SDK C/C++

Fri Apr 30, 2021 6:57 am

Hello,

A library for MPR121-based touch sensors: https://github.com/antgon/pico-mpr121

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Sat May 01, 2021 11:05 am

antgon wrote:
Fri Apr 30, 2021 6:57 am
Hello,

A library for MPR121-based touch sensors: https://github.com/antgon/pico-mpr121
Thanks! Added to the list.

Memotech Bill
Posts: 330
Joined: Sun Nov 18, 2018 9:23 am

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon May 03, 2021 9:40 am

More a complete project than a library - Emulation of another 8-bit computer (Memotech MTX). Amongst other things, the emulation will run CP/M so I can claim that as another operating system on the Pico.

https://github.com/Memotech-Bill/MEMU

Of possible interest, I was having problems with the SDK code for accessing the SD card on the VGA Demo Board in 1-bit mode. I therefore wrote my own code to access it using SPI (using a PIO as the wrong pins for hardware SPI). I am using the UART for debugging so I could not use SDK 4-bit mode, so I don't know whether that would work.

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon May 03, 2021 7:19 pm

I don't know the Memotech (I had a Nascom Z80 8 bit computer for fun and we used the 65C02 in the physics labs for control). But CP/M, Yes! Bringing back memories.

I was student representative of the advisory board to the University tasked with IT (then just called computer stuff). We were also tasked with standardisation across the university. Came a moment that we had to choose between CP/M or some crappy new kid on the block called MS-DOS. Of course, we chose CP/M, maybe it was even me that tipped the scale. Must have been a costly decision.

I'll add the project!

dbrion06
Posts: 685
Joined: Tue May 28, 2019 11:57 am

Re: STICKY: Community library list for Pi Pico SDK C/C++

Thu May 20, 2021 2:35 pm


System Thingies & Awesome Tools
Including binary files in your code (without a filesystem): See viewtopic.php?f=144&t=310346&p=1856196#p1856196
Non-blocking timers: https://github.com/Blimp01/pico_non_blocking_timer

Well, I tried blimp01 non blocking timer example and was very satisfied.
However, exemple.c https://github.com/Blimp01/pico_non_blo ... /example.c
workd without gcc being crazy once one replaces

Code: Select all

	init_non_blocking_timer(&led_timer, 1000); //initalise ledtimer for a 1second period 
by (adding another argument to the 3 arguments function init_non_blocking_time

Code: Select all

 const uint16_t Duree = 250;  //  1000;
  int idebord = 0;
  stdio_init_all();
  //  initalise ledtimer for a Duree (ms) period
  init_non_blocking_timer(&led_timer, Duree, CONTINOUS_MODE);
(i made some cosmetic changes : number of arguments fixed arm-noneabi-gcc being rude and crazy. other changes were to have it blinking faster.... counting overflows)
Then it seemed perfect to me.

zapta
Posts: 74
Joined: Thu May 06, 2021 4:23 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Sat Jun 05, 2021 4:39 am

Not sure if it belongs here so please delete it if not.

This is a proof of concept of driving a 480x320 ILI9488 TFT with a Pico using 8 bit parallel path and a PIO that generate the output signals.

https://github.com/zapta/pio_tft/tree/m ... formio/src

https://vimeo.com/manage/videos/559283972

The proof of concept updates the TFT at 30M bytes/sec which is 15M pixels/sec (two bytes per pixels) as shown in the video below. The PIO program is small (11 instructions) and support the two modes required by the ILI9488, a single byte transfers for commands and data and double byte transfers for pixels. The mode switch is done by waiting for the SM to be idle and then switching it to the other loop. The screen update API includes also a method that accepts a buffer with 8 bits pixels and mapping them on the fly to 16 bits using a lookup table as required by the ILI9488. This allows to have an in RAM buffer of the entire 320x480 screen.

antgon
Posts: 2
Joined: Fri Apr 30, 2021 6:44 am
Location: Scotland

Re: STICKY: Community library list for Pi Pico SDK C/C++

Tue Jun 08, 2021 8:25 pm

A library for controlling stepper motors, in case this is useful: https://github.com/antgon/pico-stepper.

I am aware that another stepper library was shared recently and that library works well. The differences are that this library (i) is written in C and attempts to follow the Pico SDK structure/style; (ii) adds a few more functions; and (iii) allows to step the motor using more than one stepping sequence. (I also wrote this because I wanted to try out the hardware_gpio functions that drive multiple GPIOs at once :) .)

paulo.marques
Posts: 1
Joined: Sat Jun 19, 2021 12:17 am

Re: STICKY: Community library list for Pi Pico SDK C/C++

Sat Jun 19, 2021 12:32 am

I've created a quadrature encoder as a PIO program. The code implements a proper bidirectional state machine and keeps the current step count in the Y register, so that counting steps does not use any CPU time at all. This allows the code to support very high step rates, maxing out at around 8.9 Msteps/sec.

The program then provides simple functions the main code can use to fetch the current count.

The code is here in a fork from the official pico-examples repository:

https://github.com/pmarques-dev/pico-examples
https://github.com/pmarques-dev/pico-ex ... re_encoder

I've also made a pull request, so that if the Raspberry folks feel that this would be a nice addition to the pico-examples.repository they can just review and approve the pull request.

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Sat Jun 19, 2021 10:32 am

Thanks all, for helping growing the list! It's fun, and the community is clearly growing. I added them all.

jannis
Posts: 85
Joined: Tue Jan 17, 2012 3:48 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Wed Jul 07, 2021 8:41 pm

Hi, great effort to collect rp2040-compatible libs.
I actually haven't yet written my own library but I've modified quite some so they work with the pico-sdk. It's not 100% consistent. Sometimes (at the beginning and mainly when the project's native build system is not cmake) the file to include is named CMakeLists.txt, sometimes it's called "interfaceLibForPicoSDK.cmake"

Compression algorithms:
https://github.com/kripton/brotli/tree/rp2xx
https://github.com/kripton/heatshrink/t ... ton-rp2xxx
https://github.com/kripton/snappy/tree/rp2xx
https://github.com/kripton/zlib/tree/rp2xx
https://github.com/kripton/zstd/tree/rp2xx

Other libraries:
https://github.com/kripton/libb64/tree/kripton-rp2xxx
https://github.com/kripton/jsoncpp/tree/rp2xx


The RF24* libraries to interact with radio modules using Nordic's rf24 chip will have official support for the pico-sdk soon: https://github.com/nRF24/RF24/pull/772

User avatar
led-bloon
Posts: 24
Joined: Mon Dec 03, 2012 4:48 am
Location: Oz

Re: STICKY: Community library list for Pi Pico SDK C/C++

Fri Jul 16, 2021 12:20 am

Not a library but...
MMBasic interpreter with editor and a plethora of added facilities including support for:
SPI LCD panels w/o Touch, SD card, RTC, GPS, PWM, SPI, I2C, sound and much more!
Support for generating PIO programmes using DATA statements in a bas file.
Note: Software is currently in alpha phase, however the basics of the language implemented.
http://www.thebackshed.com/forum/ViewTo ... &TID=13998

Edit: Updated link to latest offering, software now in Beta

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Tue Aug 03, 2021 8:50 am

Great. List is growing! The community is a miracle.

fhdmdev
Posts: 3
Joined: Fri Apr 02, 2021 2:51 am

Re: STICKY: Community library list for Pi Pico SDK C/C++

Wed Aug 25, 2021 5:13 am

Here's another library for the SSD1306 OLED display:
https://github.com/fhdm-dev/pico-arduin ... it-ssd1306

This is actually just a wrapper around the Adafruit_SSD1306 library. It uses a compatibility layer I've
been working on that allows (some) Arduino libraries to be used with the Pico C/C++ SDK without modification.
https://github.com/fhdm-dev/pico-arduino-compat

The C wrapper isn't strictly necessary as the Adafruit_SSD1306 library can also be accessed directly from C++ code.

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Wed Aug 25, 2021 9:06 am

Thanks @fhdmdev, I added the OLEd driver for Pico!!

I need to say (shameless plug) that I like the code part in my own library that allows to grab cooperative resources in the pico via the SDK, so (a) potentially less conflict and better cooperation with other libraries and (b) the possibilty to create more than 1 C++ object to represent more mutiple pfyscal objects (like 2 or three screen). Mostly I don't see that with Arduino wrappers, nor in the Arduino Open IDE for Pico.

Of course the Pico has limited resources and not all combination of (.e.g.) I2C resources and pins are possible, but I like my libraries to be able to captilize on the fact that the pico is more powerful than one would think at least to be able to fully utilize them in cooperation with other libraries. The SDK has various of calls for creating cooperative libraries, such as, but there are more:
  • pio_can_add_program(...), for testing whether you can still add a pio program to one of the pio's. I used that one heavily in my NeoPixel wrapper, to be able to add upto 8 Neopixels strings to one Pico. without the user to be bothered by the Pico internals.
  • irq_add_shared_handler(...), for adding interrupt handlers while not blocking other libraries that use the same interrupt (used that one in my tone library, to be able to add possibly multiple non-blocking tone generator objects, while at the same time not interfering with other libraries).
  • dma_claim_unused_channel(...), to cooperatively claim an unused DMA channel. Used this one as well in my tone generator library to find, claim and release dma handlers to push memory stored tone shapes towards pio driven pins, while freeing the CPU for other tasks.
Let's think a little about a good design pattern for cooperative libraries in the community, that cooperate with other libraries and open the power of the pico (e.g. two i2c interfaces with semi-flexible pin-assignments, etc...). But hey, I am just code struggling, juggling and learning. And also... if it works, it works.

vmilea
Posts: 3
Joined: Thu Sep 02, 2021 4:35 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Thu Sep 02, 2021 4:46 pm

In case it's useful, I've written a pair of libraries for commonly used FM radio chips:

- https://github.com/vmilea/pico_si470x for the Si4702 / Si4703
- https://github.com/vmilea/pico_rda5807 for for the RDA5807.

The chips are pretty similar, and so are the libraries. The code is plain C in SDK style, fully documented, and easy to integrate through CMake interface.

vmilea
Posts: 3
Joined: Thu Sep 02, 2021 4:35 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon Sep 13, 2021 1:18 pm

I needed the Raspberry Pico to work as an I2C slave for another device, to manage a bunch of sensors. But the official SDK is primarily for operating as master and there is no example for I2C slave mode. So I ended up reading the datasheet of the I2C controller and wrote this library: https://github.com/vmilea/pico_i2c_slave

martinkooij
Posts: 63
Joined: Sun Feb 28, 2021 5:22 pm
Location: The Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon Sep 13, 2021 7:20 pm

@vmilea: Done and Done (both posts).

slimhazard
Posts: 62
Joined: Sat Apr 03, 2021 8:47 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Tue Sep 14, 2021 6:14 pm

I just noticed that there's a benchmark section on the list. So you might consider adding:

https://gitlab.com/slimhazard/rp2040-mem-xput-bench

It measures the throughput of memcpy() and memory-to-memory DMA. Recently discussed on the forum:

viewtopic.php?f=145&t=319315

WillyO65
Posts: 15
Joined: Thu Sep 23, 2021 6:59 pm
Location: Netherlands

Re: STICKY: Community library list for Pi Pico SDK C/C++

Tue Sep 28, 2021 9:25 pm

Excellent initiative, but you might want to narrow down the scope 8-)
Debug using 0xDEADBEEF 8-)
Electronics hobbyist, tinkerer, sailor

ginolig
Posts: 1
Joined: Mon Oct 04, 2021 11:05 pm

Re: STICKY: Community library list for Pi Pico SDK C/C++

Mon Oct 04, 2021 11:10 pm

Hello, some of you may already know this library, and I want to share that I've ported the MPU6050 from there to the Pico. You can find the files inside the RP2040 folder in that repo. There are also 2 examples there, one for calibration and other for obtaining data from the DMP.

rhulme
Posts: 4
Joined: Fri Oct 08, 2021 9:54 am

Re: STICKY: Community library list for Pi Pico SDK C/C++

Fri Oct 08, 2021 10:06 am

Not a library as such but I've implemented a flashloader that can be used to perform a power-fail safe update of the application in situations where it's not possible/feasible/desirable to use the normal bootrom bootloader.

https://github.com/rhulme/pico-flashloader

It can be used either as-is or as a starting point for a more specialised situation.

Return to “SDK”