340 Commits

Author SHA1 Message Date
Dániel Buga
2e5b58b701
UART: clear RX FIFO on overflow (#3190)
* Add failing test case

* Use pointer difference as the true FIFO count

* Take FIFO pointers into account when calculating FIFO length

* Fix grammar

* Clear RX FIFO on overflow

* Update esp-hal/src/uart.rs

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Handle overflow caught by RxFuture

* Reset the fifo after clearing the interrupt

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2025-03-04 16:53:53 +00:00
yuiiio
a71c67b7d6
esp32s2: psram_cache_init typo fix (#3196)
* esp32s2: psram_cache_init typo fix

broken esp32s2 psram since
cb0016aa43

* Add PSRAM test

* Add changelog entry

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-03-03 10:05:45 +00:00
Dániel Buga
c8822b4f83
Restore multiple-integrated timer queues (#3166) 2025-02-28 13:02:58 +00:00
Dániel Buga
502d41f313
Fix Uart::flush_async (#3186)
* Fix Uart::flush_async

* Apply single-byte workaround
2025-02-28 09:50:38 +00:00
Björn Quentin
1050ce5bb4
Make sure FD SPI works after HD SPI (#3176)
* Make sure FD SPI works after HD SPI

* CHANGELOG

* Rename

* Fmt
2025-02-26 16:58:41 +00:00
Jesse Braham
6976e6d669
Update portable-atomic (#3171)
* Update `portable-atomic` dependency

* Remove `portable-atomic` hacks
2025-02-24 14:33:01 +00:00
Dániel Buga
a5bfa3a61d
Disable multiple-integrated timer queue flavour (#3159) 2025-02-21 10:01:05 +00:00
Dániel Buga
9a307f0fb3
Wait for the FIFO to be empty in flush (#3151)
* Deduplicate existing test

* Wait for the FIFO to be empty in flush
2025-02-20 09:34:20 +00:00
Dániel Buga
ff2a46dbc8
UART: make async operations cancellation-safe, update others for consistency (#3142)
* Make async operations cancellable

* Handle thresholds

* Fix written amount calculation

* Fix waiting for events

* Don't return 0 bytes, don't modify TX threshold

* Add read_exact implementation

* Fix tests

* Add tests

* Inline constant into the default values

* Make FIFO config stable

* Fix doc links

* Changelog

* Remove duplicate changelog entries

* Check for RX error

* Fix write_async not recalculating available space

* Fix ESP32 timeout loop

* Check the unmasked interrupt bits to actually detect errors

* Improve naming

* Change async handler to not clear interrupt status

* Test and fix case where write_async returned Ok(0)

* Tweak docs

* Address review feedback

* Use embedded_io to fill buffer in test

* Rename
2025-02-20 08:19:55 +00:00
Scott Mabin
07463bfabf
unstabilize Uart::split, globally remove _bytes postfix (#3137)
* unstabilize split, remove unneeded bounds

* remove _byte postfixes, make uart::flush fallible (inline with the async variant), unify read/write logic for inherent impls and trait impls

* fix tests

* changelog and migration

* put trait dm bound on driver structs

* changelog again

* fixups

* fixups

* fix uart tests

* small docs update

* small docs update

* test fix

* rebase fixup
2025-02-17 12:58:04 +00:00
Dániel Buga
1e58278a6a
Remove redundant macro syntax (#3135) 2025-02-14 08:04:07 +00:00
Dániel Buga
392d5ccdc1
Unstabilize CPU-related functionality, merge modules (#3099)
* Move Cpu to a new module

* Move cpu_control's contents into cpu

* Merge raw_core functions

* Hide cpu control APIs

* Move reset into cpu

* Fix software_reset_cpu

* Allow inlining cpu functions

* Changelog

* Mark software_reset no-return

* Move WakeupReason

* Remove PeripheralIter

* Move cpu into system

* Mark system stable
2025-02-07 14:15:26 +00:00
Kirill Mikhailov
477e1d6521
More validation and # Errors entries (#3074)
* WIP

* updates

* upd

* +spi

* fmt + lint

* rework `Exact` setting

* Reviews + spi failed experiment

* clean

* address reviews, roll back SPI changes

* rebase

* small fixes

* address reviews

* reviews

fmt

Rebase

dumb

* address reviews

unstable: macro -> feat
2025-02-06 14:40:26 +00:00
Scott Mabin
6f5c48e54c
Allow more baud rates (#3104)
* merge change_baud impls

* merge further with pac updates

* avoid overflow when calculating uart clk divider

* xfmt

* avoid u64 ops

* changelog

* reword comment
2025-02-06 11:05:54 +00:00
Dániel Buga
3bca047086
Fix waiting for short periods (#3093)
* Shorten test delays

* Fix TIMG

* Fix systimer

* Changelog

* Use a single future implementation

* Explain level interrupts
2025-02-05 14:53:58 +00:00
Dániel Buga
c21e50e850
Fix BLE controller test (#3097) 2025-02-05 10:19:36 +00:00
Dániel Buga
8c69e8cb51
Newtype fugit Rate, Instant and Duration (#3083)
* Newtype fugit Rate, Instant and Duration

* Document, remove time::now

* Fix perf

* Tweak docs
2025-02-04 17:23:08 +00:00
Dominic Fischer
fe53061931
Migrate PARL_IO driver to newer DMA API (#3033)
* Migrate PARL_IO driver to newer DMA API

* Register waker when necessary

* Basic HIL test

* fmt

* oops

* return resources on error

* Invert sampling edge

* Attempt manual formatting

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2025-02-03 11:58:20 +00:00
Dominic Fischer
4739a67ad7
Migrate AES driver to DMA move API (#3084)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2025-02-03 09:00:45 +00:00
Björn Quentin
23dfcf6560
Have a very basic BLE hil test (#3073)
* Have a very basic BLE hil test

* don't try to run BLE test on S2, but do on H2

* Don't enable esp-wifi/wifi for H2

* Explain
2025-01-31 11:59:36 +00:00
Dániel Buga
6aa17819a5
DMA test: Avoid starving out thread-mode executor (#3064)
* Avoid looping without delay

* Avoid starving out thread-mode executor

* Clean up a bit
2025-01-30 17:14:54 +00:00
Dániel Buga
af6ee36d93
Ability to precompute/cache config register values (#3011)
* Cache bus clock register and support clock source

* Recalculate eagerly to keep Config Copy

* Destabilize UART clock source

* Update I2C

* Changelog

* Refactor builder lite helpers for more flexibility

* Flatten config structs

* Add getters, hide fields

* Hide all config fields

* Fix changelog

* Document the precomputation
2025-01-30 09:44:52 +00:00
Dániel Buga
ad1b645b0f
Don't register waker if the DMA is done (#3045)
* Don't register waker if the DMA is done

* Update embassy-executor in HIL tests
2025-01-28 08:45:28 +00:00
Dániel Buga
fbca764c85
Don't enable unstable for stable SPI tests (#3047) 2025-01-28 08:19:35 +00:00
Dániel Buga
ce750b5fe4
Remove OutputOpenDrain (#3029)
* Remove OutputOpenDrain

* Remove input-related functions from Output

* Fix documentation

* Improve docs
2025-01-27 16:41:58 +00:00
Dániel Buga
5139ff1a48
Remove yml exception for S3 (#3039)
* Remove yml exception for S3

* Fix warnings
2025-01-27 12:59:03 +00:00
Dániel Buga
f7be6a3f6c
Allow specifying env vars for examples/HIL tests (#3028)
* Remove unused CHIP-FEATURES

* Refactor metadata collection

s

* Allow specifying esp-config options

* Document xtask

* Try to explain multiple configurations a bit better
2025-01-27 10:41:31 +00:00
Björn Quentin
f247b4099c
Remove flip-link feature, replace by flip-link option (#3001)
* Fix renamed config options

* Make `flip-link` feature into a config-option

* Remove `psram-quad`/`psram-octal` - replaced by `psram`

* Changelogs

* Fix

* Add `esp_config::Validator::Enumeration`

* Fix HIL-tests

* HIL: use octal psram for the S3

* Fix xtask

* xtask

* examples

* Make `spi-address-workaround` only available on ESP32

* Always allow `cfg(spi_address_workaround)`

* Make config-options valid for all targets
2025-01-23 15:21:46 +00:00
Dániel Buga
e842ec4c6c
Slight GPIO cleanup, un-stabilize Io (#3021)
* Clean up, add fixme

* Destabilize Io, add inherent set_interrupt_handler

* Explicitly mark functions, not the impl block
2025-01-23 15:02:11 +00:00
Jesse Braham
4ea6b76f0a
Add configuration structs for GPIO drivers, make constructors fallible (#2990)
* Add configuration structs for GPIO drivers, make constructors fallible

* Update all examples and HIL tests to use new GPIO driver API

* Update migration guide

* Update `CHANGELOG.md`

* Fix errors

* Add `apply_config` functions

* Fixes
2025-01-22 14:20:06 +00:00
Dániel Buga
ae35b465bf
Fix DMA not having data available in time (#3003)
* Fix DMA not having data available in time

* Fix not registering I2S interrupts when only using TX
2025-01-21 20:28:15 +00:00
Dániel Buga
537829df36
Remove Deref to pac register block from peripheral singletons (#2956) 2025-01-21 14:12:27 +00:00
Dániel Buga
5ec8be4af2
Fix LCD_CAM disabling its clocks (#3007) 2025-01-21 10:31:20 +00:00
Dániel Buga
04ba779f2d
Async: !Send (#2980)
* Actually add inherent set_interrupt_handler fns

* Mark Async drivers !Send
2025-01-20 18:31:02 +00:00
Dániel Buga
0894e301c9
Replace pointer derefs with regs function (#2974)
* Do not mix peripheral singletons with PAC types

* Replace pointer derefs with regs function
2025-01-20 08:30:05 +00:00
Björn Quentin
5f2c0ec5f2
Support 3-wire-SPI (#2919)
* Support 3-wire-SPI

* CHANGELOG.md

* Remove 'Error::ArgumentsInvalid', more docs

* Rebase Fix

* `DataMode::Single` -> `DataMode::FourWire`

* Rename, again

* docs wording

* Honor ESP32

* Have some testing for DataMode::Single

* Mark `with_sio0/1` unstable
2025-01-17 16:34:34 +00:00
Sergio Gasquez Arcos
c88dbefff8
Avoid using nb::Result as a return type (#2882)
* feat: Avoid using nb::Result in spi

* feat: Avoid using nb::Result in hmac

* feat: Avoid using nb::Result in sha

* feat: Avoid using nb::Result in usb_serial_jtag

* feat: Avoid using nb::Result in adc::read_oneshot

* feat: Avoid using nb::Result in rsa::ready

* feat: Avoid using nb::Result in timer::wait

* feat: Avoid using nb in uart and twai. Udpate examples and tests to avoid using block!

* feat: Block on sha calls, remove Option<> results

* feat: Block on hmac calls, remove Option<> results

* fix: Clippy lints

* feat: Block on spi calls, remove Option<> results

* feat: Block on timer calls, remove Option<> results

* feat: Block on twai calls, remove Option<> results

* docs: Fix wait docstring

* feat: Remove embedded_hal_nb traits

* feat: Block on uart calls, remove Option<> results

* feat: Remove nb stuff from usb_serial_jtag

* feat: Block on rsa calls, remove Option<> results

* feat: Clippy lints

* feat: Make read_bytes return how many bytes it read from the fifo and fix docs/tests

* fix: run_test_periodic_timer test

* feat: Only remove nb from stabilizing drivers

* feat: Remove unused functions

* feat: Remove emnbedded-hal-nb

* test: Adapt tests

* docs: Update changelog and migration

* test: Adapt tests

* docs: Update migration guide

* docs: Update migration

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* docs: Update changelog and migration guide

* feat: Make `write_bytes` return an Result

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-01-17 15:46:20 +00:00
Benedikt
2105ba0f81
RMT: Use gpio::Level for carrier and pulse levels (#2989)
* rmt: Use gpio::Level instead of bool to specify output levels

* rmt: Use gpio::Level for PulseCode::level{1|2}
2025-01-17 11:58:34 +00:00
Dániel Buga
04f62ec36d
Fix priority locks on RISC-V (#2964)
* Use normal interrupt lock when priority==max

* Fix priority locks
2025-01-15 15:04:33 +00:00
Dániel Buga
240f79021d
Define a stable set of SPI tests (#2934) 2025-01-15 10:05:19 +00:00
Dániel Buga
571760884b
Update our time driver for upcoming embassy changes (#2701)
* Add a timer-driven task

* Spawn another timer

* Log

* foo

* Do not access current time on each schedule

* Update generic queue

* Minimize alarm priorities

* Point to github with patches

* Fix build without any queue impl selected

* Remove explicit generic-queue features

* Define cfgs, fix calling something uninitialized

* Clean up RefCell+generic queue

* Fix arg order

* Feature

* Fix single integrated-timer queue

* Fix next expiration when arming

* Add note

* Adjust impl to latest changes

* Local patch

* Refactor the refactor refactor

* Track the timer item's owner

* Clear owner on dequeue

* Clean up

* Point at the right branch

* Fix panic message

* Hide private function

* Remove integrated-timer references

* Point at upstream embassy

* Configure via esp-config

* Document, clean up, fix

* Hack

* Remove patches

* Update config separator, test the complex variant

* Undo esp-config hack

* Remove trouble example, update edge-net

* Update test deps

* Document

* Update bt-hci.

* Fix generic queue

* Fix panic message

* Fix UB

* Fix rebase

* Resolve UB

* Avoid mutable reference in interrupt executor

---------

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2025-01-14 16:17:58 +00:00
Dániel Buga
4e70ad6ced
Minor pre-release cleanup (#2950)
* Default-enable unstable features until 1.0

* Update delegate
2025-01-14 10:29:59 +00:00
Dániel Buga
8c48c74039
Make Uart::read_bytes blocking (#2935) 2025-01-13 14:44:45 +00:00
Dániel Buga
e13c09eb92
Remove logic from InputPin and OutputPin (#2926)
* Hide PAC types exposed via peripheral singletons

* Rename AlternateFunction variants

* Move logic to AnyPin

* Remove degrade_pin

* Add a note to GPIO

* Remove mask

* Fix test
2025-01-10 14:50:03 +00:00
Juraj Sadel
03ea4f6c90
Remove the single byte read/write inherent functions (#2915)
* SPI: remove read/write_byte functions

* UART: make read/write_byte functions private

* changelog

* migration guide

* fix ieee802154_sniffer example

* review comments and cleanup

* use variable name buf instead of buff

* add pub fn read_bytes

* migration guide update

* another migration guide update

* improve docs of read/write_bytes
2025-01-10 14:36:24 +00:00
Kirill Mikhailov
8d948ba017
Mark unstable modules, make macros private (#2900)
* Mark unstable APIs + make `macros` private

* address reviews

* use `instability` instead of feature

* fix dependencies

* More tagging

* `Persistable` and `procmacros` - unstable

* Adjust for changes

* sure...
2025-01-10 14:32:34 +00:00
Dániel Buga
8fad94344e
Fix thread-mode executor on core1 not waking up (#2924) 2025-01-10 12:37:28 +00:00
Björn Quentin
69031e614b
Add AcknowledgeCheckFailedReason (#2862)
* Add `AcknowledgeCheckFailedReason`

* Fix

* Remove unused AcknowledgeCheckFailedReason variants

* Re-introduce Data and Address, again

* Clippy + Tests

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2025-01-10 08:57:46 +00:00
Dániel Buga
848029b152
Test all feature sets (#2901)
* Mark interconnect as unstable

* Explicitly set unstable feature in HIL tests

* WIP append feature set name to artifact

* Add name to feature sets, build all combinations

* Fix tests

* Provide a looping executor for stable async tests

* Fix usb serial jtag

* Hide interconnect types
2025-01-09 13:58:14 +00:00
Dániel Buga
0ef00206d5
Remove all instance type params (#2907) 2025-01-09 11:27:48 +00:00