- Add support for Raspberry Pi Compute Module 5.
- Gpio: Add
set_bias
toInputPin
(contributed by @KronsyC). - Gpio: Add shared state button example (contributed by @CosminPerRam).
- Spi: Fix embedded HAL
SimpleHalSpiDevice
transactions to keep CS low between operations (contributed by @whatisbyandby). - Spi: (Breaking change) Change
SimpleHalSpiDevice::new()
to require anSpi
instance, instead of a generic HAL bus (contributed by @whatisbyandby). - Uart: Check if
/dev/ttyAMA0
exists and fall back to/dev/serial0
when callingnew()
on Raspberry Pi 5 or Compute Module 5.
- Gpio: Add
Event
struct, containing interrupt event details. - Gpio: (Breaking change) Add optional
debounce
argument toset_interrupt()
andset_async_interrupt()
. - Gpio: (Breaking change) Return an
Event
struct when an interrupt is triggered, instead ofLevel
.
- Gpio: (Breaking change) Add support for mode
Null
for uninitialized (FUNCSEL 31 (NULL)) pins on Raspberry Pi 5 (contributed by @lukeburong). - Gpio: Fix
InputPin
mode not getting set correctly for uninitialized pins on Raspberry Pi 5 (contributed by @lukeburong). - Pwm: (Breaking change) Add
Error::UnknownModel
. - Pwm: Fix support for hardware PWM on Raspberry Pi 5, caused by incorrect PWM chip/channel.
- Fix
is_low
implementation forembedded_hal::digital::InputPin
(contributed by @TeyKey1).
- (Breaking change) Update
embedded-hal
to v1.0.0 (contributed by @reitermarkus).
- Minor documentation changes.
- (Breaking change) Update
embedded-hal
to v1.0.0-rc.2 (contributed by @reitermarkus). - (Breaking change) Update
embedded-hal
to v1.0.0-rc.1 (contributed by @mbuesch). - (Breaking change) Change Minimum Supported Rust Version (MSRV) to v1.60.0.
- Remove
Hardware
field check in/proc/cpuinfo
. - Fix device recognition for Raspberry Pi Zero 2 W (2021) on Arch Linux (contributed by @denisandroid).
- Add support for Raspberry Pi 5 (thanks @ukscone for all the testing!).
- Gpio: (Breaking change) Rename
PullUpDown
enum toBias
, andset_pullupdown()
toset_bias()
. - Gpio: Add support for new modes
Alt6
,Alt7
andAlt8
. - I2c: Implement I2C transactions for
embedded-hal
(contributed by @CBJamo).
- Gpio: Fix subtract underflow panic in software-based PWM.
- (Breaking change) Transition to Rust 2021, requiring rustc v1.56.0 or newer to compile the library.
- Gpio: Implement
unproven
embedded-hal
traitdigital::v2::IoPin<IoPin, IoPin>
forIoPin
(contributed by @rumatoest). - Gpio: Implement
From<bool>
trait forLevel
(contributed by @makerio90). - Gpio: Fix error when configuring an InputPin for GPIOs > 31 on BCM2711 (contributed by @benkard).
- Gpio: Fix access to GPIO54 - GPIO57 on BCM2711.
- Gpio: (Breaking change) Add
Error::PinUsed
, returned byGpio::get()
to indicate a pin is already in use. - Gpio: (Breaking change) Change
Error::PinNotAvailable
, returned byGpio::get()
to indicate a pin isn't available on the current Raspberry Pi model. - Update
embedded-hal
to v1.0.0-alpha.9 (contributed by @mbuesch).
- DeviceInfo: Add device identification support for Raspberry Pi Compute Module 4 models with 4GB and 8GB RAM.
- DeviceInfo: Add device identification support for Raspberry Pi Zero 2 W.
- Add support for
embedded-hal
v1.0.0-alpha.5 (contributed by @reitermarkus). - Gpio: Add
into_output_low()
andinto_output_high()
toPin
to set the logic level before changing the pin mode. - Gpio: Implement
From<u8>
trait forLevel
, where0
is converted intoLevel::Low
, and any other value intoLevel::High
.
- (Breaking change) Require rustc v1.45.0 or newer to compile the library due to std API stabilizations.
- DeviceInfo: (Breaking change) Replace manual non-exhaustive pattern implementations for
Model
andSoC
with#[non_exhaustive]
. - DeviceInfo: Add device identification support for Raspberry Pi 4 B v1.2, Raspberry Pi 400 and Raspberry Pi Compute Module 4.
- Gpio: Fix built-in pull-up/pull-down resistor support for Raspberry Pi 4 B (contributed by @Dragonrun1).
- Gpio: Add BCM2711 ioctl support (contributed by @foxzool).
- Hal: (Breaking change) Upgrade
embedded-hal
trait implementations fordigital::v1::{InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin}
todigital::v2
. These can be explicitly converted back todigital::v1
throughdigital::v1_compat::{OldInputPin, OldOutputPin}
for backwards compatibility with older drivers. - I2c: Accept slave addresses below 0x08 (contributed by @Majkl578).
- I2c: Add documentation for I2C3, I2C4, I2C5 and I2C6.
- Pwm: Improve error messages (contributed by @binarybana).
- Pwm: Improve documentation for Ubuntu (contributed by @binarybana).
- Spi: (Breaking change) Add support for SPI3, SPI4, SPI5 and SPI6.
- DeviceInfo: Add device identification support for Raspberry Pi 4 B. (Support for the new peripherals will be added in 0.12.0)
- Add
hal-unproven
feature flag (disabled by default), which enablesunproven
embedded-hal
trait implementations. Note thatembedded-hal
'sunproven
traits don't follow semver rules. Patch releases may introduce breaking changes. - Gpio: Implement
Sync
trait forIoPin
andOutputPin
. - Gpio: Implement
unproven
embedded-hal
traitdigital::InputPin
forPin
,InputPin
,OutputPin
andIoPin
. - Gpio: Implement
unproven
embedded-hal
traitsdigital::{StatefulOutputPin, ToggleableOutputPin}
andPwm
forOutputPin
andIoPin
. - Gpio: Remove internal
MSG_WAITING
flag from software PWM implementation to resolve an issue found in the wild causing delays in message processing (contributed by @aehmlo). - Hal: Add
hal
module, containingembedded-hal
trait implementations that aren't tied to a specific peripheral. - Hal: Implement
embedded-hal
traitsblocking::delay::{DelayMs, DelayUs}
forDelay
. - Hal: Implement
embedded-hal
traittimer::CountDown
forTimer
(contributed by @jacobrosenthal). - Pwm: Implement
Display
trait forChannel
andPolarity
. - Pwm: Implement
unproven
embedded-hal
traitPwm
forPwm
. - Spi: Implement
Display
trait forBitOrder
,Bus
,Mode
,Polarity
andSlaveSelect
. - Spi: Remove
From<Error>
implementation due to a conflict withnb
v0.1.2 (contributed by @gferon). - Uart: Add support for the PL011 and mini UART peripherals, USB to serial adapters, XON/XOFF software flow control and RTS/CTS hardware flow control.
- Uart: Implement
embedded-hal
traitsserial::{Read, Write}
andblocking::serial::Write
forUart
.
- Fix incorrect data type conversion on 64-bit OSes when libc uses 64-bit
timespec
fields.
- Add
hal
feature flag (disabled by default), which includesembedded-hal
trait implementations for all supported peripherals. - Add
Gpio
example demonstrating software-based PWM. - DeviceInfo: (Breaking change) Add support for Raspberry Pi Compute Module 3+.
- DeviceInfo: (Breaking change) Add hidden
Model::__Nonexhaustive
andSoC::__Nonexhaustive
variants, indicatingModel
andSoC
shouldn't be exhaustively matched. After this change, adding new variants to these enums when a new Raspberry Pi model is released won't be considered a breaking change anymore. This is a hack that can still be circumvented, but anyone that does so should be aware of the repercussions. This will be replaced once#[non_exhaustive]
stabilizes. - Gpio: Add software-based PWM to
OutputPin
andIoPin
throughset_pwm()
,set_pwm_frequency()
andclear_pwm()
. - Gpio: Add
is_set_low()
andis_set_high()
toOutputPin
to check the pin's output state. - Gpio: Implement
embedded-hal
traitsdigital::OutputPin
andPwmPin
forOutputPin
andIoPin
. - I2c: Implement
embedded-hal
traitsblocking::i2c::{Read, Write, WriteRead}
forI2c
. - Pwm: Add
reset_on_drop()
andset_reset_on_drop()
toPwm
to optionally keep the PWM channel enabled on drop (contributed by @benkard). - Pwm: Implement
embedded-hal
traitPwmPin
forPwm
. - Spi: Implement
embedded-hal
traitsspi::FullDuplex
andblocking::spi::{Transfer, Write}
forSpi
.
- (Breaking change) Transition to Rust 2018, requiring rustc v1.31.0 or newer to compile the library.
- Add new badge to
README.md
, indicating the required minimum rustc version. - Add
Gpio
,I2c
,Pwm
andSpi
examples to the examples subdirectory. - Rewrite
Display
formatting forError
s in all modules to include more details when available. - DeviceInfo: (Breaking change) Remove
DeviceInfo::peripheral_base()
andDeviceInfo::gpio_offset()
from the public API. - Gpio: (Breaking change) Move pin-specific methods from
Gpio
to the newInputPin
/OutputPin
structs. Access pins throughGpio::get()
(contributed by @reitermarkus). - Gpio: Add a new
IoPin
struct which allows mode switching between input, output or an alternate function. - Gpio:
Gpio::get()
returns an owned unconfiguredPin
, which can be used to read the pin's mode and logic level. Convert aPin
to anInputPin
,OutputPin
orIoPin
through the variousPin::into_
methods to access additional functionality. - Gpio: Add a variety of convenience methods to
InputPin
,OutputPin
andIoPin
for common tasks. - Gpio: (Breaking change) Remove
Error::NotInitialized
,Error::UnknownMode
andError::InvalidPin
(contributed by @reitermarkus). - Gpio: (Breaking change) Remove
Error::InstanceExists
. Multiple (thread-safe)Gpio
instances can now exist simultaneously. - Gpio: (Breaking change) Rename
Error::UnknownSoC
toError::UnknownModel
for consistency. - Gpio: (Breaking change) Add relevant file path to
Error::PermissionDenied
to make it easier to solve file permission issues. - Gpio: (Breaking change) Add
Error::PinNotAvailable
, returned byGpio::get()
to indicate a pin is already in use, or isn't available on the current Raspberry Pi model. - Gpio: (Breaking change) Rename
clear_on_drop()
/set_clear_on_drop()
toreset_on_drop()
/set_reset_on_drop()
for clarity. - Gpio: (Breaking change) Change
Gpio::poll_interrupts()
pins
input parameter and return type fromu8
to&InputPin
(contributed by @reitermarkus). - Gpio: When a pin goes out of scope, if an asynchronous interrupt trigger was configured for the pin, the polling thread will get stopped.
- Gpio: Disable built-in pull-up/pull-down resistors when a pin goes out of scope and
reset_on_drop
is set to true. - Gpio: Implement
Clone
forGpio
. - I2c: (Breaking change) Rename
Error::UnknownSoC
toError::UnknownModel
for consistency. - Pwm: (Breaking change) Rename
duty_cycle()
topulse_width()
andset_duty_cycle()
toset_pulse_width()
to better reflect the specified value type. - Pwm: (Breaking change) Rename
enabled()
tois_enabled()
for more idiomatic predicates. - Pwm: Add
duty_cycle()
,set_duty_cycle()
andfrequency()
convenience methods that convert between frequency/duty cycle and period/pulse width. - Pwm: Fix incorrect return values for
period()
,duty_cycle()
,polarity()
andenabled()
caused by whitespace. - Spi: (Breaking change) Rename
TransferSegment
toSegment
. - Spi: (Breaking change)
Segment::new()
parameters are no longer wrapped inOption
. UseSegment::with_read()
orSegment::with_write()
instead when a full-duplex transfer isn't needed. - Spi: Add
Segment::with_read()
andSegment::with_write()
convenience methods for read operations without any outgoing data, or write operations where any incoming data should be discarded.
- DeviceInfo: (Breaking change) Add support for Raspberry Pi 3 A+.
- Add support for musl (contributed by @gferon).
- Gpio: Replace GPIO sysfs interface (
/sys/class/gpio
) for interrupts with GPIO character device (/dev/gpiochipN
). - Pwm: Add support for up to two hardware PWM channels with configurable period/frequency, duty cycle and polarity.
- Spi: Fix 0-length transfers caused by
TransferSegment
instances withwrite_buffer
set toNone
.
- Revert the use of the recently stabilized
Duration::subsec_millis()
back toDuration::subsec_nanos()
to allow older stable versions of the compiler to work.
- DeviceInfo: (Breaking change) Remove
Error::CantAccessProcCpuInfo
. - DeviceInfo: Add additional options to automatically identify the Pi model when /proc/cpuinfo contains inaccurate data.
- Gpio: (Breaking change) Remove
Error::ChannelDisconnected
. - I2c: Add support for I2C with basic read/write, block read/write, and write_read.
- I2c: Add support for SMBus with Quick Command, Send/Receive Byte, Read/Write Byte/Word, Process Call, Block Write, and PEC.
- Reduce external dependencies.
- DeviceInfo: (Breaking change) Return model and soc by value, rather than by reference.
- DeviceInfo: (Breaking change) Remove
SoC::Bcm2837
to reduce ambiguity. The Pi 3B and Compute Module 3 now return the more accurateSoC::Bcm2837A1
. - DeviceInfo: (Breaking change) Remove
SoC::Unknown
. An unknown SoC is now treated as a failure. - DeviceInfo: Return the actual SoC based on the Raspberry Pi model, rather than the inaccurate
/proc/cpuinfo
data. - Gpio: (Breaking change) Remove
InterruptError
. Merge remaining errors withError
. - Gpio: (Breaking change) Replace all
DevGpioMem
andDevMem
errors withError::PermissionDenied
andError::Io
. - Gpio: (Breaking change) Change the return value for
poll_interrupt()
andpoll_interrupts()
toOk(Option)
on success, withSome()
indicating an interrupt triggered, andNone
indicating a timeout occurred. - Gpio: (Breaking change) Only a single instance of
Gpio
can exist at any time. Creating another instance before the existing one goes out of scope will return anError::InstanceExists
. - Spi: Add support for SPI with half-duplex reads/writes and full-duplex multi-segment transfers.
- Gpio: Add
poll_interrupts()
, which waits for multiple synchronous interrupts at the same time. - Gpio: Add public interface for
InterruptError
. - Cleanup documentation.
- DeviceInfo: Add hardcoded Raspberry Pi 3 B+ SoC identifier, rather than relying on inaccurate info from
/proc/cpuinfo
. - Gpio: Add support for asynchronous interrupts (
set_async_interrupt()
,clear_async_interrupt()
). - Gpio: Add support for synchronous interrupts (
set_interrupt()
,clear_interrupt()
,poll_interrupt()
).
- Gpio: Replace
&mut self
with&self
where possible.
- DeviceInfo: (Breaking change) Add support for Raspberry Pi 3 B+.
- DeviceInfo: Set memory offsets based on model info rather than SoC.
- (Breaking change) To adhere to Rust's naming conventions, several structs and enums that had GPIO, IO, BCM or CPU in their name have been changed to
Gpio
,Io
,Bcm
andCpu
respectively. - Gpio: Add GPIO as a temporary (deprecated) type alias for
Gpio
.
- DeviceInfo: Add additional revision codes for old models.
- GPIO: Always try
/dev/mem
after/dev/gpiomem
fails. Return new errorPermissionDenied
when both/dev/gpiomem
and/dev/mem
have permission issues. This is a workaround for Ubuntu Core 16 where/dev/gpiomem
can't be accessed by applications installed using snap (reported by @VBota1).
- DeviceInfo: Change returned
u32
references to copied values.