Pi Ada tutorial 1.5.2 (#1884)

Co-authored-by: Martin Krischik <martin.krischik@kpt.ch>
This commit is contained in:
Martin Krischik
2026-04-25 12:46:06 +02:00
committed by GitHub
parent 0c186dbbb1
commit 4115555bab
7 changed files with 461 additions and 0 deletions
@@ -0,0 +1,60 @@
name = "pico_ada_c01_blink"
description = "Chapter 1: Blinking LEDs - Getting Started on the Raspberry Pi Pico"
long-description = """My first steps into Ada programming on the Pico: from Jeremy Grosser's classic
blink example through explicit pin control to using an external LED, plus thoughts on the elegant (but still
experimental) Ravenscar profile.
Starting simple with LED blinking in Ada - internal LED, external LED with proper renaming, and a look at why Ravenscar
looks so clean (even if it's not quite ready for everyday use yet).
Contained in Chapter 01 are:
1. blink - Jeremy Grosser Ada sample
2. sketch_01_1_blink - Chapter 1.1 Blink internal LED
3. sketch_01_2_blink - Chapter 1.2 Blink external LED
Read the full tutorial at [Chapter 1: Blinking LEDs - Getting Started with Ada on the Raspberry Pi
Pico](https://pi-ada-tutorial.sourceforge.io/pico_ada_c01_blink), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c01_blink/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico_ada_c01_blink/)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c01_blink"
tags = ["raspberry", "pi", "pico", "rp2040", "ada2022", "embedded"]
executables = [
"blink",
"sketch_01_1_blink",
"sketch_01_2_blink"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
pico_bsp = "^2"
# vim: set textwidth=72 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:a3b2713a2df92dfdc7a47cdc8994d3fe03ce81902b0d0d501fccc1f748da65d4",
"sha512:b12bffdec925e1424fb830efece4a55263e3f487b5ee120f576979f1954a181f509f2b4c1493983ad75f0ade0f3e00d8df9aaebce3e08b2cebfcab53d8f8bb7c",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c01_blink-1.5.2.tgz"
@@ -0,0 +1,70 @@
name = "pico_ada_c01_blink_lt"
description = "Chapter 1 Reloaded: Blinking LEDs on Both Cores"
long-description = """Blinking LEDs on Both Cores Updated Chapter 1 using the new light_tasking_rp2040
runtime - now with proper multi-core support, Ada.Real_Time, and delay until for accurate, slippage-free LED blinking on
Raspberry Pi Pico.
After quick community help, I rewrote Chapter 1 to use light tasking on both RP2040 cores. No more manual timers -
clean, precise dual-LED blinking with zero slippage.
Contained in Chapter 01 reloaded are:
1. blink - Jeremy Grosser Ada sample
2. sketch_01_1_blink - Chapter 1.1 Blink internal LED
3. sketch_01_2_blink - Chapter 1.2 Blink external LED
4. double_blink-main - double blink using both cores.
Read the full tutorial at [Chapter 1 Reloaded: Dual-Core Light Tasking - Blinking LEDs on Both
Cores](https://pi-ada-tutorial.sourceforge.io/pico_ada_c01_blink_lt), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c01_blink_lt/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico2_ada_c01_blink_lt/)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c01_blink_lt"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
executables = [
"blink",
"sketch_01_1_blink",
"sketch_01_2_blink",
"double_blink-main"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
rp2040_hal = "^2.7.1"
pico_bsp = "^2.2.0"
light_tasking_rp2040 = "^15.3"
[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
light_tasking_rp2040.Max_CPUs = 2
light_tasking_rp2040.Board = "rpi_pico"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:2ee316232f0b6ba8caa9a3828282f8cd6034e6a07f6e52fd2289d8ec560043de",
"sha512:814b51ac8e2e433c6af5cb046bc9893afd318d92cd9464a5618ceb4eaea5a17c349cae7acfb92f32161a0e901ac6c3345a62c889d84c84574b9ee8e432c84e4d",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c01_blink_lt-1.5.2.tgz"
@@ -0,0 +1,65 @@
name = "pico_ada_c02_button_and_led"
description = "Chapter 2 - Button controled LEDs"
long-description = """Controlling an LED with a button on the Raspberry Pi Pico using Ada - two simple
but useful interaction examples.
In this chapter I combine a push button with an LED. We start with basic on/off control, then move to a toggle-style
table lamp with software debounce.
Contained in Chapter 02 are:
1. sketch_02_1_button_and_led - Chapter 2.1 Switch LED with Button
2. sketch_02_2_table_lamp - Chapter 2.2 Simple table lamp
Read the full tutorial at [Chapter 2 - Button &
LED](https://pi-ada-tutorial.sourceforge.io/pico_ada_c02_button_and_led), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c02_button_and_led/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico_ada_c02_button_and_led/)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c02_button_and_led"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
executables = [
"sketch_02_1_button_and_led",
"sketch_02_2_table_lamp"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
rp2040_hal = "^2.7.1"
pico_bsp = "^2.2"
light_tasking_rp2040 = "^15.3"
[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
light_tasking_rp2040.Max_CPUs = 2
light_tasking_rp2040.Board = "rpi_pico"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:a2ec4b3d003662f4c7591cbf5cf84404d4fd3d73b23abf34ce0b7468bb0e21f0",
"sha512:f5f4ca4504e16a0c76f5d14cf93e7a1797967d4568dc438077a90673124561b68f12ebdc700da9fffcdfcf45066777fb26747d7e9c1ab2ddd71bc4670fe2faa3",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c02_button_and_led-1.5.2.tgz"
@@ -0,0 +1,70 @@
name = "pico_ada_c03_led_bar"
description = "Chapter 3 - Cylon LED Bar: flowing light upgraded to a menacing scanner"
long-description = """Building a smooth flowing LED bar on the Raspberry Pi Pico with Ada - from a simple
chasing light to a proper menacing Cylon scanner effect using real-time delays.
In this chapter we turn ten LEDs into a flowing light bar. We start with the basic Freenove example using an array of
RP.GPIO.GPIO_Point (aliased limited tagged types). We then improve it with a pre-calculated sine-harmonic timing table
to create a realistic Cylon scanner - all done with Ada.Real_Time and zero floating-point at runtime for perfect
jitter-free movement.
Contained in Chapter 03 are:
1. Sketch_03_1_Flowing_Light - straight port of the classic flowing light
2. Cylon_Light - the final dramatic Cylon scanner with organic easing
3. Cylon_Light_Float - Floating point version of Cylon_Light
Read the full tutorial at [Chapter 3 - Cylon LED Bar: flowing light upgraded to a menacing
scanner](https://pi-ada-tutorial.sourceforge.io/pico_ada_c03_led_bar), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c03_led_bar/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico_ada_c03_led_bar/)
(The Cylons did nothing wrong. Humans created the perfect companion species and then completely messed it up.)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c03_led_bar"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
executables = [
"sketch_03_1_flowing_light",
"cylon_light_float",
"cylon_light"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
rp2040_hal = "^2.7.1"
pico_bsp = "^2.2"
light_tasking_rp2040 = "^15.3"
[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
light_tasking_rp2040.Max_CPUs = 2
light_tasking_rp2040.Board = "rpi_pico"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:2e6a401c49cc2aa79571584e9dc0636c538107729ba308c34ea93bad1f0bf6b2",
"sha512:3adaf15aca09fadd6010347da6862f5a785e9e35bc46d3cd640f7253ffbd6523720ff298fd36bfae4721ca1de14c96013fb038216bbda0dc5b2c2837a9f41469",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c03_led_bar-1.5.2.tgz"
@@ -0,0 +1,69 @@
name = "pico_ada_c04_pwm"
description = "Chapter 4: Analog LED with PWM"
long-description = """Building smooth breathing LEDs and flowing light bars with hardware PWM on the
Raspberry Pi Pico using Ada. From jittery duty cycles to perfect linear dimming - guided by the Voltcraft MSO-5102B
oscilloscope and a deep dive into PWM slice mapping on both Pico 1 and Pico 2.
In this chapter we create a reusable Pico.Analog package for PWM-based analogue output. We start with a classic
breathing light, then move on to a flowing light bar. Along the way the MSO-5102B reveals the real behaviour of our
code, and we discover (and fix) a subtle bug in the experimental RP2350 HAL.
Contained in Chapter 04 are:
1. Pwm - Original PWM sample from Jeremy Grosser
2. sketch_04_1_breathing_light - Chapter 4.1 Blink internal LED
3. sketch_04_2_flowing_light_2 - Chapter 4.1 Project Meteor Flowing Light
Read the full tutorial at [Chapter 4: Analog & PWM](https://pi-ada-tutorial.sourceforge.io/pico_ada_c04_pwm), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c04_pwm/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico_ada_c04_pwm/)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c04_pwm"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
executables = [
"pwm",
"sketch_04_1_breathing_light",
"sketch_04_2_flowing_light_2"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
rp2040_hal = "^2.7.1"
pico_bsp = "^2.2"
pico_xbsp = "^1.5"
light_tasking_rp2040 = "^15.3"
[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
light_tasking_rp2040.Max_CPUs = 2
light_tasking_rp2040.Board = "rpi_pico"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:03761a8e4bd3774f03f48aa30cc5d71f8a68a80a240edc7ec8fe3724c42b8681",
"sha512:942fd4aa8b70addc97743c12f8ad416836abf47275c1a7eaf996311c655b9a7c91bbf2f8e5897489105eedfa7470c0350948056510d58478a263d8f095e3e8cc",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c04_pwm-1.5.2.tgz"
@@ -0,0 +1,67 @@
name = "pico_ada_c05_rgb"
description = "Chapter 5: Controlling an RGB LED with PWM"
long-description = """Learn how to drive a common-cathode RGB LED using the RP2040's PWM peripherals.
This chapter introduces a reusable Ada package for colour control and demonstrates both random colours and a smooth
colour-wheel gradient.
Extend the simple LED examples to full-colour control with an RGB LED. Create a reusable `Pico.Analog.RGB_LED` package
and explore two sketches: random colours (using the embedded runtime) and a smooth colour-wheel transition.
Contained in Chapter 05 are:
2. sketch_05_1_random_color_light.adb - Chapter 5.1 Random Color Light
3. sketch_05_2_gradient_color_light.adb - Chapter 5.2 Gradient Color Light
Read the full tutorial at [Chapter 5: Controlling an RGB LED with
PWM](https://pi-ada-tutorial.sourceforge.io/pico_ada_c05_rgb), [GNATdoc
documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_ada_c05_rgb/), [SourceForge
repository](https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/pico_ada_c05_rgb/)
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/pico_ada_c05_rgb"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
executables = [
"sketch_05_1_random_color_light",
"sketch_05_2_gradient_color_light"
]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
rp2040_hal = "^2.7.1"
pico_bsp = "^2.2"
pico_xbsp = "^1.5"
embedded_rp2040 = "^15.3"
[configuration.values]
rp2040_hal.Use_Startup = false
rp2040_hal.Interrupts = "bb_runtimes"
embedded_rp2040.Max_CPUs = 2
embedded_rp2040.Board = "rpi_pico"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:38e197d0eb80efa9b428967aa313841cb733279422a30a19427900b3ff087337",
"sha512:aad119e7df8f299c57c86c85716d8ce93ec33e9760a50d9879779339bfd8a2368fbef471e8329088e2a2b666ca91c4cc81491d55817a5a463474f0834e1ce4d0",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_ada_c05_rgb-1.5.2.tgz"
+60
View File
@@ -0,0 +1,60 @@
name = "pico_xbsp"
description = "Extended board support package for Raspberry Pi Pico"
long-description = """Extended board support package (XBSP) for the Raspberry Pi Pico.
This crate extends the official pico_bsp from Jeremy Grosser with additional, reusable components. It is designed for
general use in any Ada project targeting the RP2040-based Raspberry Pi Pico and is not limited to the Pi Ada Tutorial.
It is developed in parallel with the [Pi Ada Tutorial](https://pi-ada-tutorial.sourceforge.io/) and therefore also
supplies the exact support packages used in the tutorial chapters. This dual role makes pico_xbsp equally suitable for:
* Standalone embedded Ada projects that only need the extra functionality, and * Readers following the tutorial who want
ready-made, well-documented building blocks.
Current content:
1. Pico.Analog - Analogue GPIO using Pulse Width Modulation (PWM).
1. Pico.Analog.RGB_LED - Analogue RGB LED control using Pulse Width Modulation (PWM).
2. Pico.UART_IO - UART Text Output (Input comes later).
All packages are supplied with complete GNATDOC annotations.
* [GNATdoc documentation](https://pi-ada-tutorial.sourceforge.io/gnatdoc/)
* [SourceForge repository](https://sourceforge.net/projects/pi-ada-tutorial/)
The crate will grow with each new tutorial chapter while remaining a clean, independent library.
"""
version = "1.5.2"
licenses = "GPL-3.0-or-later"
authors = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers = ["Martin Krischik <krischik@users.sourceforge.net>"]
maintainers-logins = ["krischik"]
website = "https://pi-ada-tutorial.sourceforge.io/"
tags = ["raspberry", "pi", "pico", "rp2040", "tasking", "light-tasking", "ada2022", "embedded"]
[build-switches]
"*".ada_version = ["-gnat2022"]
development.compile_checks = "Warnings"
development.contracts = "Yes"
development.runtime_checks = "Overflow"
release.compile_checks = "Warnings"
release.contracts = "No"
release.runtime_checks = "Default"
validation.compile_checks = "Warnings"
validation.contracts = "Yes"
validation.runtime_checks = "Everything"
[[depends-on]]
pico_bsp = "^2.2"
# vim: set textwidth=120 nowrap tabstop=8 shiftwidth=4 softtabstop=4 expandtab :
# vim: set filetype=toml fileencoding=utf-8 fileformat=unix foldmethod=diff :
# vim: set spell spelllang=en_gb :
[origin]
hashes = [
"sha256:9c2067fc36e655b13953f58d4b1994daba69341bc4dde98516b5398e54e25f3e",
"sha512:c7340687f861b1e106543002119623b2bf95d72285730d7993d9645c69f691a54cd12f56230fdfc8f171950801f3fe97f8a52012a4abd93a3612e40b9477ffeb",
]
url = "https://sourceforge.net/projects/pi-ada-tutorial/files/Alire/pico_xbsp-1.5.2.tgz"