imxrt-rs/imxrt-hal

Release: RAL & HAL 0.4, IOMUXC 0.1

mciantyre opened this issue · 1 comments

I'm preparing a 0.4 release of the RAL and HAL. Both crates have a feature-flag change: "rtfm" => "rtic". The HAL has also accumulated new, breaking changes, which we could receive broader feedback on. The 0.4 HAL requires us to publish 0.1 releases of the IOMUXC crates.

We also have a GPIO bug fix to publish. To support any 0.3 HAL users, I'm also preparing a 0.3.1 HAL release, which backports the GPIO patch onto the 0.3 release. Users who aren't interested in adopting the 0.4 breaking changes can still have their crates fixed.

Is there any other work we'd like to include? If not, I'll release by next week.

The section below is a snippet from the HAL's CHANGELOG describing the next release.


HAL Changelog

This release contains numerous breaking HAL changes. See the "Changed" section for more information.
The release includes 0.3.1 fixes.

Added

  • steal() the top-level Peripherals object. The steal() method lets users use the imxrt_hal
    as an RTIC device.
  • DMA Memcpy may support interrupt handling
  • A new interface for pad configuration, supported by the imxrt-iomuxc crate family. See the Changed
    section for migration information.

Changed

  • BREAKING The pad configuration interface has simplified. Users will use the
    interface exposed by the imxrt-iomuxc crate family. This section describes how you might
    update your 0.3 (and earlier) code for the new interface.

    • Naming: the IOMUXC instance exposes pads with a new naming convention. Previously, member
      accessed resembled

      let peripherals = imxrt_hal::Peripherals::take().unwrap();
      peripherals.iomuxc.gpio_ad_b1_02;

      Now, IOMUXC member access resembles

      peripherals.iomuxc.ad_b1.p02

      Generally, remove the "gpio_" prefix, and replace the second underscore with member access and
      a "p" symbol.

    • Pad Types: The interface simplifies the pad types, removing the alternate type state.
      Usages resembling

      use imxrt_hal as hal;
      
      type MyPin = hal::iomuxc::gpio::GPIO_AD_B0_12<hal::iomuxc::Alt5>;

      can be simply expressed as

      type MyPin = hal::iomuxc::ad_b0::AD_B0_12;

      Note the stuttering convention of pad_group::pad_group_offset to reference pad types.

    • No alternate transition: there are no altX() methods. Usage resembling

      let mut uart = uarts.uart2.init(
          peripherals.iomuxc.gpio_ad_b1_02.alt2(),
          peripherals.iomuxc.gpio_ad_b1_03.alt2(),
          BAUD,
      ).unwrap()

      should drop the altX() calls (after renaming the pads).

      let mut uart = uarts.uart2.init(
          peripherals.iomuxc.ad_b1.p02,
          peripherals.iomuxc.ad_b1.p03,
          BAUD,
      ).unwrap();
    • Type Tags: all custom type-level constants, like imxrt_hal::uart::module::_1 are now
      typenum constants. There are no peripheral-specific constants. Usage resembling

      use imxrt_hal::uart;
      
      type MyTX = uart::Tx<uart::module::_3>;

      should update to

      use imxrt_hal::uart;
      use imxrt_hal::iomuxc;
      
      type MyTX = uart::Tx<iomuxc::consts::U3>;
    • GPIO: the new IOMUXC driver results in a simpler GPIO interface. There is now a single GPIO
      type that wraps an IOMUXC pad. Any GPIO type, like

      use imxrt_hal as hal;
      
      type HardwareFlag = hal::gpio::GPIO1IO26<hal::gpio::GPIO1, hal::gpio::Output>;

      should change to

      type HardwareFlag = hal::gpio::GPIO<hal::iomuxc::ad_b1::AD_B1_10, hal::gpio::Output>;

      The new GPIO types expose a no-return toggle() method, which shadows an embedded_hal
      trait method. If you notice compilation issues surrounding toggle(), try removing
      unwrap() calls:

      led.toggle().unwrap() // Old
      led.toggle()          // New

      Or, qualify that the ToggleableOutputPin trait method should be called.

  • BREAKING The HAL's "rtfm" feature is changed to "rtic", reflecting the framework's
    new name. Users who are relying on the "rtfm" feature should now use the "rtic" feature.

  • BREAKING The dma::{Config, ConfigBuilder} types are gone. This affects the dma::Peripheral
    interface. To configure interrupt on completion / half settings, use dma::Channel::set_interrupt_on_completion()
    / dma::Channel::set_interrupt_on_half() to perform the same configurations before suppling the
    channel to dma::Peripheral.

This set of work is quite good, nothing from me at the moment to add