Skip to content

Commit

Permalink
Merge branch 'main' into spi_with_miso
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev authored Jan 7, 2025
2 parents 065ec8b + 2a4e58a commit 9f2d217
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 104 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you have any questions, comments, or concerns, please [open an issue], [start

> [!NOTE]
>
> This project is still in the relatively early stages of development, and as such there should be no expectation of API stability. A significant number of peripherals currently have drivers implemented but have varying levels of functionality. For most tasks, this should be usable already, however some more advanced or uncommon features may not yet be implemented.
> This repository includes crates that are at various stages of maturity and stability. While many functionalities have already been implemented and are usable for most tasks, certain advanced or less common features may still be under development. Each crate may offer different levels of functionality and guarantees.

[esp-lp-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp-lp-hal
[esp-idf-svc]: https://github.com/esp-rs/esp-idf-svc
Expand Down
3 changes: 3 additions & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- I2C: Replaced potential panics with errors. (#2831)
- UART: Make `AtCmdConfig` and `ConfigError` non-exhaustive (#2851)
- UART: Make `AtCmdConfig` use builder-lite pattern (#2851)
- UART: Fix naming violations for `DataBits`, `Parity`, and `StopBits` enum variants (#2893)
- UART: Remove blocking version of `read_bytes` and rename `drain_fifo` to `read_bytes` instead (#2895)

### Fixed

Expand All @@ -100,6 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `spi::master::Spi::{into_async, into_blocking}` are now correctly available on the typed driver, to. (#2674)
- It is no longer possible to safely conjure `GpioPin` instances (#2688)
- UART: Public API follows `C-WORD_ORDER` Rust API standard (`VerbObject` order) (#2851)
- `DmaRxStreamBuf` now correctly resets the descriptors the next time it's used (#2890)

### Removed

Expand Down
42 changes: 29 additions & 13 deletions esp-hal/MIGRATING-0.22.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ is enabled. To retrieve the address and size of the initialized external memory,

The usage of `esp_alloc::psram_allocator!` remains unchanged.

## embedded-hal 0.2.* is not supported anymore.
## embedded-hal 0.2.\* is not supported anymore.

As per https://github.com/rust-embedded/embedded-hal/pull/640, our driver no longer implements traits from `embedded-hal 0.2.x`.
Analogs of all traits from the above mentioned version are available in `embedded-hal 1.x.x`
Expand Down Expand Up @@ -262,7 +262,7 @@ is not compatible with the hardware.
+.unwrap();
```

### LCD_CAM configuration changes
## LCD_CAM configuration changes

- `cam` now has a `Config` strurct that contains frequency, bit/byte order, VSync filter options.
- DPI, I8080: `frequency` has been moved into `Config`.
Expand Down Expand Up @@ -325,15 +325,15 @@ The reexports that were previously part of the prelude are available through oth
- `ExtU64` and `RateExtU32` have been moved to `esp_hal::time`
- `Clock` and `CpuClock`: `esp_hal::clock::{Clock, CpuClock}`
- The following traits need to be individually imported when needed:
- `esp_hal::analog::dac::Instance`
- `esp_hal::gpio::Pin`
- `esp_hal::ledc::channel::ChannelHW`
- `esp_hal::ledc::channel::ChannelIFace`
- `esp_hal::ledc::timer::TimerHW`
- `esp_hal::ledc::timer::TimerIFace`
- `esp_hal::timer::timg::TimerGroupInstance`
- `esp_hal::timer::Timer`
- `esp_hal::interrupt::InterruptConfigurable`
- `esp_hal::analog::dac::Instance`
- `esp_hal::gpio::Pin`
- `esp_hal::ledc::channel::ChannelHW`
- `esp_hal::ledc::channel::ChannelIFace`
- `esp_hal::ledc::timer::TimerHW`
- `esp_hal::ledc::timer::TimerIFace`
- `esp_hal::timer::timg::TimerGroupInstance`
- `esp_hal::timer::Timer`
- `esp_hal::interrupt::InterruptConfigurable`
- The `entry` macro can be imported as `esp_hal::entry`, while other macros are found under `esp_hal::macros`

## `AtCmdConfig` now uses builder-lite pattern
Expand All @@ -343,11 +343,10 @@ The reexports that were previously part of the prelude are available through oth
+ uart0.set_at_cmd(AtCmdConfig::default().with_cmd_char(b'#'));
```


## Crate configuration changes

To prevent ambiguity between configurations, we had to change the naming format of configuration
keys. Before, we used `{prefix}_{key}`, which meant that esp-hal and esp-hal-* configuration keys
keys. Before, we used `{prefix}_{key}`, which meant that esp-hal and esp-hal-\* configuration keys
were impossible to tell apart. To fix this issue, we are changing the separator from one underscore
character to `_CONFIG_`. This also means that users will have to change their `config.toml`
configurations to match the new format.
Expand All @@ -371,6 +370,23 @@ The `Config` struct's setters are now prefixed with `with_`. `parity_none`, `par
+ .with_parity(Parity::Even);
```

The `DataBits`, `Parity`, and `StopBits` enum variants are no longer prefixed with the name of the enum.

e.g.)

```diff
- DataBits::DataBits8
+ DataBits::_8
- Parity::ParityNone
+ Parity::None
- StopBits::Stop1
+ StopBits::_1
```

The previous blocking implementation of `read_bytes` has been removed, and the non-blocking `drain_fifo` has instead been renamed to `read_bytes` in its place.

Any code which was previously using `read_bytes` to fill a buffer in a blocking manner will now need to implement the necessary logic to block until the buffer is filled in their application instead.

## Spi `with_miso` has been split

Previously, `with_miso` set up the provided pin as an input and output, which was necessary for half duplex.
Expand Down
4 changes: 4 additions & 0 deletions esp-hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ For help getting started with this HAL, please refer to [The Rust on ESP Book] a
[s2-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf
[s3-trm]: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf

## `unstable` feature

The stable feature set is designed to remain consistent and reliable. Other parts guarded by the `unstable` feature, however, are still under active development and may undergo breaking changes and are disabled by default.

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.83 and up. It _might_
Expand Down
14 changes: 6 additions & 8 deletions esp-hal/src/dma/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,13 +1137,6 @@ impl DmaRxStreamBuf {
return Err(DmaBufError::InsufficientDescriptors);
}

// Link up all the descriptors (but not in a circle).
let mut next = null_mut();
for desc in descriptors.iter_mut().rev() {
desc.next = next;
next = desc;
}

let mut chunks = buffer.chunks_exact_mut(chunk_size);
for (desc, chunk) in descriptors.iter_mut().zip(chunks.by_ref()) {
desc.buffer = chunk.as_mut_ptr();
Expand Down Expand Up @@ -1176,7 +1169,12 @@ unsafe impl DmaRxBuffer for DmaRxStreamBuf {
type View = DmaRxStreamBufView;

fn prepare(&mut self) -> Preparation {
for desc in self.descriptors.iter_mut() {
// Link up all the descriptors (but not in a circle).
let mut next = null_mut();
for desc in self.descriptors.iter_mut().rev() {
desc.next = next;
next = desc;

desc.reset_for_rx();
}
Preparation {
Expand Down
Loading

0 comments on commit 9f2d217

Please sign in to comment.