PicoLibSDK
Alternative Extended C/C++ SDK library for Raspberry Pico and RP2040
Version 1.12, May 2024
(c) Miroslav Nemecek
https://github.com/Panda381/PicoLibSDK
Picopad on pajenicko.cz - SALES
Picopad Song: YouTube ... video ... mp3 ... Lyrics
Contents:
PicoLibSDK is an alternative
extended C/C++ SDK library for the Raspberry Pico module with the
RP2040 processor, with easy compilation under Windows. It can
also be used for other modules which use this processor. Compared
to the original SDK library, the PicoLibSDK library tries to
extend the functionality of the original library and especially
to make the SDK library easier to use.
Boot Loader: Boot loader allowing to select and run UF2 programs from SD card.
SDK hardware control: ADC, boot ROM, system clocks control, CPU control, hardware divider, DMA, double and float arithmetics, FIFO mailboxes, flash programming, GPIO, I2C, hardware interpolator, IRQ, multicore, PIO, PLL, PWM, QSPI, reset and power control, ROSC, RTC, SPI, spinlocks, SysTick, alarm timer, watchdog, XOSC.
Tool library: alarm, 32-bit Unix calendar, long 64-bit astronomic calendar, canvas drawing, RGBA color vector, CRC check with DMA support, decode numbers, emulators, escape packet protocol, event ring buffer, FAT file system, doubly linked list, memory allocator, 2D transformation matrix, mini-ring buffer, formatted print, PWM sound output, random generator, rectangle, ring buffer, DMA ring buffer, SD card, streams, text strings, text list, text print, tree list, VGA drawing, video player.
USB library: multiplayer mini-port, CDC device and host - serial communication, HID device and host - including external keyboard and mouse.
Big intergers: calculations with large integers, calculation of Bernoulli numbers.
Real numbers: calculations with floating-point numbers with optional precision up to 3690 digits and 30-bit exponent. Scientific functions with optional calculation method - Ln, Exp, Sqrt, Sin, Cos, Tan, arcus, hyperbolic functions and many more. Linear factorials with accurate and fast calculation.
Display drivers: Prepared support of TFT, DVI and VGA display.
Devices: Support of boards Picoino/PicoinoMini/Picotron/DemoVGA/PicoPadVGA with VGA display, PicoPad with TFT display and basic Raspberry Pico without additional hardware.
Compatibility: The library is backwards compatible with the original SDK library in most functions. Most functions can be called from the original SDK library, although internally they are often handled differently.
Boot loader for running programs from the SD card:
The library source code is,
with a few exceptions, completely free to use for any purpose,
including commercial use. It is possible to use and modify all or
parts of the library source code without restriction. The only
exceptions are the single- and double-floating-point mathematics
libraries, which are mostly the copyrighted work of Raspberry Pi
and Mark Owen and are therefore subject to the licensing terms of
the original authors.
Download PicoLibSDK library (source codes, images of SD card, sample programs)
Download manual for PicoLibSDK library (formats DOC, ODT, PDF)
PicoLibSDK on Github: https://github.com/Panda381/PicoLibSDK
Video with slide-show player to compare videomodes of PicoLibSDK
SD card contents for PicoPadVGA
SD card contents for board DemoVGA
SD card contents for PicoinoMini
Sample programs for Raspberry Pico
Picopad Song: YouTube ... video ... mp3 ... Lyrics
Target Devices
The main target device, for which the library is currently prepared, is the PicoPad console, with a 16-bit 320x240 pixel TFT display, 8 buttons and a microSD card. Most programs and games on the PicoPad can also be controlled from the USB keyboard, which is connected to the Pico's USB connector via a power splitter that also provides an external +5V power supply. Key mapping: A->Ctrl, B->Alt, X->Shift, Y->Esc.
PicoPad 1.0 schematic diagram (or as PDF):
PicoPad 0.8
A compilation is also ready for PicoPad version 0.8, which was the first PicoPad prototype. The compilation serves more as a demonstration of the possibility of an alternative configuration of the compilation.
PicoPad 0.8 schematic diagram (or as PDF):
PicoPadVGA is an alternative to the PicoPad console with VGA display output. It is typically used in 320x240 pixel resolution with a 16-bit RGB565 color format. A 400x300 pixel resolution is also supported. Most programs and games on the PicoPadVGA can also be controlled from the USB keyboard. PicoPadVGA must be powered from an external +5V power supply via power USB connector. Key mapping: A->Ctrl, B->Alt, X->Shift, Y->Esc. Download sources for PicoPadVGA
PicoPadVGA schematic diagram:
PicoPadVGA component fitting:
Another prepared compilation alternative is the Picoino, a predecessor to the PicoPad, with a built-in 56-button keyboard and output to a VGA monitor in 8-bit RGB332 color mode. The library is prepared with 320x240 image resolution. Together with the PicoVGA library, higher resolutions and combined modes are possible. Download sources for Picoino.
Sample programs for Picoino are prepared by adapting programs for PicoPad - graphics changed from 16-bit to 8-bit and 8 keyboard buttons mapped to PicoPad codes (cursors, Space -> A, Z -> B, Ctrl ->X, BackSpace -> Y) are used for control.
Picoino 1.0 schematic diagram:
Picoino 1.0 component fitting:
Picoino 1.0 output to VGA monitor:
As the smaller brother of the PicoPad, a lightweight version of the Picoino was created, which has 8-bit RGB332 output to a VGA display (QVGA 320x240 mode), an SD card, an external connector like the PicoPad and 8 buttons like the PicoPad. It is mainly intended for Raspberry Pico programming tutorials, as it allows easy assembly from common household supplies - 3 resistors and a VGA connector can be enough for output to a VGA monitor. Download sources for PicoinoMini.
PicoinoMini schematic diagram:
PicoinoMini component fitting:
PicoinoMini output to VGA monitor:
DemoVGA is a demo module with output to a VGA monitor in 320x240 pixel resolution, 16-bit RGB565 color format. Includes SD card, additional USB power connector, headphone output and 3 buttons. An external USB keyboard is used for some programs (typically games). Download sources for DemoVGA.
DemoVGA schematic diagram:
DemoVGA component fitting:
Picotron is a simple minicomputer focused on technical applications. It has an output to a VGA display with a resolution of up to 800x600 pixels, 4-bit color output in YRGB1111 mode (16-color mode as in PC-CGA and EGA). It also has an SD card, headphone audio jack and a keyboard of 40 micro-switches. Download sources for Picotron.
Picotron schematic diagram:
Picotron component fitting:
Raspberry Pico
The library is also ready for the basic Raspberry Pico module, without additional hardware. This is mainly used to test basic tutorials for the Raspberry Pico.
The library has 56 sample programs and games. SD card images are prepared for each target device. Before using the SD card, you need to load the boot loader into the processor - this is possible either by loading the LOADER.UF2 program from the root folder of the SD card image, or by loading any other program, as each program contains a boot loader at the same time. The programs can be exited by pressing the Y button and going to the boot loader.
Config - Setup PicoPad configuration. Sets volume, display backlight, ADC reference voltage, battery measurement voltage, temperature measurement calibration, crystal frequency calibration..
SD-card boot loader - the program is loaded into RAM memory and allows writing a new boot3 loader from the SD card to flash memory (possibly with the application). But it also saves the flash memory contents to a UF2 file without modifying the flash memory contents by running this program.
Frequency generator - Generates a rectangular signal or PWM signal (sine, sawtooth, triangle - sample rate 100 kHz), frequency range from 0.01 Hz to 100 MHz. Accuracy 5 digits (30 ppm) or 6 digits (up to 3 ppm, depending on crystal calibration accuracy). Output to either GPIO14 or GPIO15 (with speaker).
Frequency meter - measures frequency from 2 inputs (GPIO1 and GPIO14) in the range of 0.0256 Hz to 100 MHz, with an accuracy of 5 digits (30 ppm) or 6 digits (up to 3 ppm, depending on calibration accuracy) after crystal calibration. It also measures low frequencies with full accuracy, i.e. it is not just a simple pulse counter. It combines 3 different methods during measurement, using both PIOs.
RC meter - measures the resistance of resistors, capacitance and ESR of capacitors. An adapter with 5 resistors, connected to an external connector, is needed according to the following diagram. GPIO0 ... resistor 200 ohm, GPIO1 ... resistor 2 Kohm, GPIO14 ... resistor 20 Kohm, GPIO26 ... resistor 200 Kohm, GPIO27 ... resistor 2 Mohm, GPIO28 ... test input. In case of PicoPadVGA it is necessary to disable the VGA output pins using the DIL switch. Resistors: 0.1 ohm up to 100 Mohm, precision 5% (lower on ends of range). Capacitors: 5 pF up to 5 mF, precision 10%. The capacitor measurement method uses a logarithmic regression of the capacitor charging and discharging curves.
141-PF - calculator emulator with Intel 4004 processor.
Test emulators for many
processors, along with sample applications.
Videos can be played by program VIDEO.UF2 on devices PicoPad and DemoVGA. They where generated using the PicoPadVideo program. Videos must be uploaded to the SD card in the /VIDEO folder.
Download Base Set (310 MB), set contains:
BIRDS .....
(00:44, 17 MB) Two squabbling birds in a cage
CANORA .... (00:29, 11 MB) Czech medieval music
group Canora
CORALS .... (05:42, 134 MB) Fish in Egypt among
corals
MANDEL .... (09:05, 214 MB) Mandelbrot Fractal
Deep Zoom 10^220
Download more sample videos (due to the closure of the Ulozto server the links are broken, only for illustration):
BUNNY
..... (04:56, 116 MB) Bugs Bunny - Rabbit Season and Duck Season
(English dubbing)
CIMRMAN ... (66:09, 1556 MB) Cimrman - Long, Wide and
Nearsighted (Czech dubbing)
KYARY
..... (04:18, 101 MB) Kyary Pamyu Pamyu - Ring a Bell
MINION
.... (12:12, 287 MB) Minion Madness
MOLE
...... (13:01, 307 MB) How the Mole got his pants (Czech dubbing)
SHREK
..... (00:59, 23 MB) Final song from Shrek 1
SNOWHITE ..... (80:07, 1885 MB) Snow White and Seven Dwarfs
(Czech dubbing)
TROOPERS .. (53:20 1255 MB) Troopers
Pictor (Picopad Collector) is a shooting game. It was created in two versions. Firstly for the Picopad console, with a graphics resolution of 320x240 pixels, and secondly as a Windows application, with a higher graphics resolution of 960x720 pixels and with higher quality sound. The game contains 12 backgrounds (for 12 scenes), 13 actors, 36 enemies and 12 music loops. The game is available with the source code as Open Source and can be used, or parts of it, for any purpose. The source code for the Windows version of the game can be compiled using MS VC++ 2005..
Pictor for Windows and Pictor for Picopad:
Download Pictor for Windows (45 MB)
Download Pictor for Windows, with source code (90 MB)
Pictor on Github, Windows version: https://github.com/Panda381/Pictor
Pictor on Github, version for Picopad console: https://github.com/Panda381/PicoLibSDK/tree/main/PicoPad/GAME/PICTOR
Pictor UF2 for Picopad: https://github.com/Panda381/PicoLibSDK/tree/main/!PicoPad10/GAME
03/08/2023 PicoPad prototype with pre-alpha PicoLibSDK version 0.8.
04/28/2023 PicoPad full version with alpha PicoLibSDK version 0.90
06/28/2023 alpha PicoLibSDK version 0.91, improved battery measurement
07/30/2023 version 1.00: first final release
08/06/2023 version 1.01: printf() print memory block, stdio to UART and FILE, add Pico and PicoinoMini devices, some USB repairs
08/14/2023 version 1.02: added video player, added DemoVGA board, added compilation scripts for Linux
08/19/2023 version 1.03: SPI SD card speed fix, timer-alarm treatment for short times
08/26/2023 version 1.04: Replace qvga/vga/qdraw/drawtft libraries with more versatile minivga/draw libraries with 4/8/15/16 bit output and 320x240 to 800x600 pixel resolution. Slide-show player added. Added Picotron device, with 4-bit VGA output. Added BOOTSEL to boot3 loader (in Battery menu).
09/09/2023 version 1.05: CSYNC in VGA driver, added PicoVGA8 library, added VREG library, setup volume and backlight, calibrate crystal.
10/03/2023 version 1.06: added PicoPadVGA device and some drawing functions.
10/06/2023 version 1.07: support for RAM programs, support for saving and loading Flash boot loader.
10/18/2023 version 1.08: simulate keypad using USB keyboard (USE_USBPAD, A->Ctrl, B->Alt, X->Shift, Y->Esc).
12/05/2023 version 1.09: ADPCM sound compression, original-SDK interface.
12/30/2023 version 1.10: Intel 4004/4040 CPU emulator, DVI (HDMI) display, DVIVGA (HDMI with VGA) display, file selector
01/27/2024 version 1.11: loader passes home path to the application; CPU emulators: I4004, I4040, I8008, I8048, I8052, I8080, I8085, I8086, I8088, I80186, I80188, M6502, M65C02, X80, Z80.
05/01/2024 version 1.12: Screen saver in loader to turn off when charging. Simple PC DOS emulator.
Miroslav Nemecek