RPi-WiringPi
view release on metacpan or search on metacpan
stop/reap, cleanup-driven stop, forgotten-stop exit reaping) for
leak-checking under valgrind
- Added lib/RPi/WiringPi/WORKERS.pod (perldoc RPi::WiringPi::WORKERS),
the OO concurrency/background-worker guide leading with $pi->worker()
and demoting raw fork/threads to "under the hood"; cross-linked from
the worker() method POD and the FAQ
- Added docs/threads-examples.md, the markdown companion to
RPi::WiringPi::WORKERS; cross-linked with docs/interrupt-examples.md
- Implicit cleanup of any object the user never explicitly cleanup()'d
now runs from an END block, while the IPC::Shareable segment is still
alive, instead of from DESTROY at global destruction. This makes the
implicit teardown actually reset the pins and unregister the object,
and silences the "during global destruction" warnings that were
emitted when DESTROY operated on a half-torn-down shared segment
- Added t/03-meta.t coverage asserting the entire meta blob (including
deeply nested user data) round-trips and stays in a single shared
memory segment, guarding against IPC::Shareable per-nested-ref
segment fan-out
- Retired the broken build_testing/shared_data.pl scratch script and
updated build_testing/benchmark/sharelite_vs_memfile.pl (renamed to
shareable_vs_memfile.pl) onto IPC::Shareable, removing the last
references to the dropped IPC::ShareLite backend
- Removed t/154-sig_die_multi.t and t/155-sig_die.t: both asserted that a
caught eval { die } resets pins to INPUT, which the module does not
provide (cleanup restores each pin's captured original mode, not
INPUT). Real process-death cleanup remains covered by t/112/113/114
- Added meta_remove() to RPi::WiringPi::Meta, which frees the underlying
shared memory segment (and semaphore) entirely rather than only
emptying it like meta_erase(); a later meta_* call transparently
recreates a fresh segment. bin/pimetaerase gained an optional fourth
'remove' argument that removes the segment after erasing
- Fixed pin cleanup on the Raspberry Pi 5: wiringPi's pinModeAlt() cannot
set alt mode 31 ("no function", the pristine default for many RP1
GPIO pins), so cleanup() left those pins in their last-used mode. We
now fall back to pinctrl for the alt-31 case (gated on alt == 31 and
pi_rp1_model(), so legacy Pi 3/4 behaviour is unchanged). RPiTest's
rpi_reset() got the same fallback. Requires gpio-group membership
(documented in the FAQ)
- Bumped the RPi::SysInfo prerequisite from 1.00 to 1.01, which fixes
gpio_info() (now uses pinctrl; raspi-gpio was removed from current Pi
OS) and raspi_config() (now reads /boot/firmware/config.txt). Updated
the t/403/404/406/407 sysinfo tests for the corrected output and made
them board/OS-agnostic, with additional assertions
- Reworked the crash/signal handling. We no longer trap $SIG{__DIE__}
(which fired on every die, including a caught eval { die }, silently
resetting your pins); hardware cleanup on a crash or normal exit is
handled by the END/DESTROY path instead. $SIG{INT}/$SIG{TERM} are now
installed correctly (the old form raised "Not a subroutine reference"
when a signal fired) and chain to any handler you installed first
- fatal_exit now actually works (it was a no-op): on a trapped INT/TERM
we reset the hardware, then either re-raise to terminate (default) or,
with fatal_exit => 0, continue running. POD updated to match
- Stopped pin cleanup's pinctrl shell-out from clobbering the program's
exit status (local $?/$! in _restore_pin_alt)
- Completed the Pi 5/RP1 pin-restore fix: on the RP1, get_alt() returns a
mode enum, not a classic alt number, so pinModeAlt() could not restore
INPUT (0) or OUTPUT (1) â only alt 31 was handled before. cleanup() and
RPiTest's rpi_reset() now restore INPUT/OUTPUT via pinMode() (and "no
function" via pinctrl), so a pin left in OUTPUT (eg. by a worker) is
properly returned to its default. t/213-worker.t now asserts BCM18 is
restored; clears the cascade that failed t/400-407 in a full sweep
- Made t/107-alt_modes.t board-aware: its "default mode is INPUT" check
now reads the per-board default (INPUT on Pi 3/4, "no function"/alt 31
on Pi 5), and the classic ALT0-5 round-trip block is skipped on the
Pi 5 / RP1, whose funcsel scheme doesn't match it (alt 1/2 don't take).
Pi 3/4 behaviour is unchanged
- Made io_led() and pwr_led() board-aware: Pi 5 / RP1 names its LEDs
ACT/PWR rather than led0/led1, which produced "tee: .../led0: No such
file or directory" noise and left the LEDs undriven. Resolved via
pi_rp1_model(); restore triggers are now board-correct (PWR default
is "none" on Pi 5, "input" on earlier boards)
- Bumped the RPi::SysInfo prereq to 1.02, which adds the inherited
pi_model() method (normalized board name, Pi 0-5) plus the camera
(libcamera), core_temp (thermal-zone) and network_info (ip addr)
fallbacks for current Raspberry Pi OS
- Added t/408-sysinfo_pi_model.t covering the inherited pi_model()
- Documented pi_model() in the SYNOPSIS, method list and FAQ
- Corrected the FAQ/POD to show config.txt at both /boot/firmware (Bookworm
and later) and /boot (older), and network_info using ifconfig or ip addr
- Updated RPiTest's Pi 5 default pin-config for the now-enabled SPI, I2C
and UART buses: GPIO2/3 (I2C) report funcsel 7, GPIO9/10/11 (SPI)
report 4, and GPIO14/15 (UART) report 3 and idle high. Previously these
encoded the bus-disabled values (0/0/31), so rpi_check_pin_status()
mis-validated once the interfaces were turned on
- Tightened the GPIO14/15 check in rpi_check_pin_status() and
rpi_verify_pin_status(): dropped the "alt == 2" escape hatch (a
serial-disabled workaround) now that the enabled UART reports a
deterministic funcsel, folding 14/15 into the standard per-board check
- Fixed rpi_check_pin_status() to emit the "I2C locked ... skipping pins
2 and 3" note only when the OLED lock file is actually present; it
previously printed unconditionally
- Re-enabled t/315-serial.t by removing its blanket skip_all, and removed
two meta_lock(name => ..., state => ...) calls that used a non-existent
signature (meta_lock takes a single lock flag) and crashed the test;
the RPI_SERIAL gate (and TX/RX loopback requirement) still govern it
- Reconciled the Pi 5 default-pin table and serial/Bluetooth note in
docs/test-platform/test-pinout-doc.md, the serial POD note in
RPi::WiringPi, and fixed a "ram=i2c_arm" typo in the FAQ, to match the
enabled-bus pin values
- Fixed gpio_layout() in Core infinitely recursing into itself instead
of dispatching to WiringPi::API's implementation
- Fixed pwm_mode() getter form croaking; with no param it now returns
the current mode instead of dying, and only the setter form marks
PWM as in-use
- Fixed _pwm_in_use() registration guard using && where every sibling
guard uses ||; with rpi_register_pins disabled it wrote pwm.users
meta that cleanup() could never clear
- cleanup() now removes only the calling object's uuid from a shared
pin's users and resets/deletes the pin only when no users remain,
mirroring the PWM teardown (it previously dropped the pin for all
co-owners)
- Fixed new() re-running GPIO setup when RPI_PIN_MODE held the falsy
WPI scheme (0); the env check is now defined-based like Core's
pin_scheme(), so a second object no longer restamps WPI mode to GPIO
- pwm_range()/pwm_mode() default return values now use the
PWM_DEFAULT_RANGE/PWM_DEFAULT_MODE constants instead of the magic
numbers 1023/1 (resolves the long-standing FIXME)
- All shared-memory critical sections now run under an internal
_meta_txn() wrapper that guarantees meta_unlock() runs even if the
section dies (a die between lock and unlock previously held the
exclusive lock indefinitely across processes)
( run in 1.265 second using v1.01-cache-2.11-cpan-9581c071862 )