Skip to content

Migrate tutorials to integer GPIO numbers - #578

Merged
floitsch merged 6 commits into
masterfrom
floitsch/gpio-nums
Aug 5, 2026
Merged

Migrate tutorials to integer GPIO numbers#578
floitsch merged 6 commits into
masterfrom
floitsch/gpio-nums

Conversation

@floitsch

@floitsch floitsch commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • migrate tutorial snippets and checked-in tutorial code to integer GPIO arguments
  • update tutorial and snippet-check dependencies to their latest available releases
  • update SSD1306 examples for the current pixel-display API
  • run hardware-only snippets in analyze mode and pin CI to Toit v2.0.0-alpha.197

Validation

  • analyzed all tutorial Toit sources with -Werror using alpha.196
  • ran the affected documentation snippet checks
  • verified updated tools and SSD1306 lockfiles install cleanly
  • ran git diff --check

Alpha.197 was released after local validation; CI may temporarily fail while release binaries propagate.

floitsch added 6 commits July 1, 2026 23:42
Peripheral and driver pin parameters in the SDK and driver packages moved from
`gpio.Pin` to integer GPIO numbers (the peripheral reserves/releases the pin
itself). Update the tutorial code and the matching documentation snippets so pins
that are handed to a peripheral/driver are passed as integers:

- SDK peripherals: i2c.Bus, spi.Bus, gpio.Adc, gpio.Touch, gpio.pwm.
- Driver packages: dhtxx (dht11), pixel-strip (neopixel), hc-sr04 (ultra).

Pins that are driven directly (led/button outputs, inputs read with .get/.wait-for,
the raw hc-sr04 example) keep using gpio.Pin -- that is not the deprecated path.

Bump the driver package versions the tutorials now require to their anticipated
int-API minor release:
- toit-dhtxx       @v1   -> @v1.11
- toit-pixel-strip @v1.3 -> @v1.4
- toit-hc-sr04     @v2   -> @v2.3

The ds18b20 tutorial keeps gpio.Pin: toit-ds18b20 was not part of the migration
campaign, so its constructor still takes a gpio.Pin.
toit-ds18b20 now accepts an integer GPIO number (the one-wire bus reserves and
releases the pin). Pass the integer directly to Ds18b20 and drop the gpio.Pin.
Bump the package pin to the int-API release: @2 -> @2.2.
@floitsch
floitsch merged commit 228086e into master Aug 5, 2026
5 checks passed
@floitsch
floitsch deleted the floitsch/gpio-nums branch August 5, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant