61 Commits

Author SHA1 Message Date
Dániel Buga
517b5ccbe2
Make cargo xfmt respect the format config (#3739)
* Make cargo xfmt respect the format config

* Make sure comments and doc code have the same width
2025-07-03 08:18:02 +00:00
Juraj Sadel
c6437c7a44
Update examples and qa-test to new bootloader (#3541) 2025-05-26 10:37:41 +00:00
Dániel Buga
a828331a62
GPIO interrupts, once more (#3408)
* Add test case

* Split into files

* Do not clear interrupt status bits in handler

* Document changes

* Refactor gpio tests to test the default interrupt handler by default

* Fix typo

* Extract mk_static

* Write a bit about interrupt handling

* Various fixes

* Test that the future doesn't resolve for a preceding interrupt

* Add multi-core test

* ESP32: handle GPIO interrupt on the listening core

* Fix multi-core edge case
2025-04-30 13:03:33 +00:00
Dániel Buga
ffbcae162a
Simplify Flex (#3387)
* Simplify Flex

* Rename functions
2025-04-22 12:30:34 +00:00
Kirill Mikhailov
b33b877592
Bump edition to 2024, bump MSRV to 1.85 (#3391)
* inter-state

* inter-state (2)

* warnings fix

* fix warnings

* fmt + changelogs

* another unsafe extern "C" doode

* real fmt now

* MSRV + format

* Ignore unsafe_op_in_unsafe_fn lint for now in esp-hal and esp-wifi

* msrv + fmt

* ugh....

* get lcd_cam example right

* expr_2021 -> expr experiment

* gagagugu

* reviews

* more unneeded unsafes (help)

* finish esp-hal unsafe cleanup

* each unsafe call is marked separately

fmt

* should be good now (?)

* piece was never an option...

* dumb
2025-04-22 10:39:11 +00:00
Dániel Buga
0a4089b4d3
Refactor GPIO pin types (#3349) 2025-04-09 08:20:37 +00:00
Dániel Buga
9db968b473
Remove Peripheral/PeripheralRef (#3305)
* Rework GPIOs without Peripheral/PeripheralRef

* Completely remove Peripheral/Ref

* Remove lifetime from DMA Channel structs

* Try to document changes

* Explain reborrow

* Add lifetime to Instance traits, make them public

* Add Trace to changelog

* Remove lifetimes from Instance traits

* Rewrite section about singletons

* Remove unintended doc comment

* Remove inherent degrade

* Fix reiniting esp-wifi

* Add examples to the root-level docs
2025-04-03 10:40:07 +00:00
Dániel Buga
f6b467402a
Don't require interconnect signals to be Peripheral impls (#3302)
* Fix unsoundness around DerefMut

* Don't require interconnect signals to be Peripheral impls

* Remove Peripheral impl from pin drivers

* Changelog

* Yeet Level and NoPin impls

* Re-add missing Sealed impl for mutable references

* Relax
2025-03-28 14:52:05 +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
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
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
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
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
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
97598968eb
GPIO: prevent woken task interrupting GPIO handler (#2838)
* Clear interrupt bit before allowing waker to wake a task

* Add test
2024-12-19 07:53:48 +00:00
Juraj Sadel
d54f8440a5
HIL(QOL): Use global timeout instead of timeout macros (#2489)
* HIL(QOL): Add missing timeouts to various tests

* Increase timeouts for ECC

* Use global timeout in hil tests

* sha: increase test_digest_of_size_1_to_200 timeout from 10 to 15 seconds
2024-12-04 12:03:39 +00:00
Dániel Buga
a6a83d3bb5
Track async GPIOs in memory (#2625)
* Track async GPIOs in memory

* Add an example

* Deduplicate interrupt handling

* Changelog

* Add gpio_bank_1 symbol

* Derive EnumCount

* Try to fix issues around manual listen calls and multi-core

* Fix test

* Update esp-hal/src/gpio/mod.rs

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

* Do not prevent pending interrupt from being handled

* Remove unnecessary unpin

* Add a note about interrupt status flags

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-12-02 15:35:10 +00:00
Scott Mabin
7095576e6a
Move interrupt related bits out of lib.rs and into the interrupt module (#2613)
* move interrupt related bits out of lib.rs and into the interrupt module

* changelog and migration guide

* review
2024-11-27 10:29:32 +00:00
Kirill Mikhailov
a00643f22d
Remove embedded-hal 0.2.x impls and deps from esp-hal (#2593)
* Initial remove

* update ssd1306 driver version

* small docs cleanup

* migration guide

* changelog entry

* update changelog entry (move under `Removed` section)

* eh migration guide link

* `Wait` trait linking
2024-11-25 14:13:10 +00:00
Dániel Buga
fbc57542a8
Remove pins from Io (#2508)
* Split pins off of Io

* Remove the GPIO peripheral

* p.GPIO
2024-11-12 10:36:25 +00:00
Dániel Buga
d32a7336bb
Simplify traits and erratum 36 workaround, add Pins::steal (#2335)
* Simplify erratum 36

* Add Pins::steal

* Fix typo

* Move pin operations into Flex

* Cleanup braces

* Avoid panicking when handling erratum

* Add disable_usb_pad to other devices

* Touch up changelog

* Fix changelog
2024-10-18 14:17:43 +00:00
Dániel Buga
c7a2368845
Print test panics using semihosting (#2257)
* Print panic messages using semihosting

* Don't use defmt's asserts

* Make RA_OFFSET available without panic-handler

* Re-add defmt imports where missing

* Revert unintended test change

* Initialise hal in critical-section test

* Disable defmt in tests by default
2024-10-04 06:31:39 +00:00
Björn Quentin
a3304c6cff
Fix eh0.2 set_high/set_low (#2265) 2024-10-02 12:45:11 +00:00
Dániel Buga
7a733a75db
GPIO interconnect (#2128)
* Allow accessing signal list via ErasedPin

* Replace AnyPin with more flexible signal config

* Update tests and examples

* Fix enable_from_gpio value

* Access signals from pin drivers

* DummyPin is not a pin

* Remove redundant public fns

* Various fixes, rename ErasedPin

* Changelog

* rustfmt

* Update i8080

* Typos and endless recursion

* Drop Pin suffix from traits

* Extract AF conversion

* Touch up changelog

* Clean up spi tests

* Refactor pull resistor handling

* Don't disable configured output functionality

* Clean up TODO

* Tweak docs

* Clean up examples
2024-09-11 15:15:55 +00:00
Juraj Sadel
f374d6a102
Enable SPI_DMA_XX_ASYNC and _PCNT tests on ESP32 and S2, remove GPIO usage from description (#2140) 2024-09-11 10:23:07 +00:00
Juraj Sadel
17daa464ba
Enable ESP32 HIL (#1977)
* Enable ESP32 HIL

* RMT fixed

* SPI DMA partially works, _pcnt tests not working

* bckup

* finish

* readme and cleanup

* rebase + cleanup

* RMT S2 pin typo + clean forgotten comments

* review comments

* update 10000

* indentation

* replace cfg gate with cfg_if
2024-09-06 08:53:27 +00:00
Dániel Buga
f11c18a6b9
Optionally type-erased GPIO drivers (#2075)
* Remove type erased gpio structs

* Implement Peripheral for ErasedPin

* Simpler type erasing, accept ErasedPin in pin drivers, remove type erased drivers

* Reformulate pin drivers using Flex

* Erase gpio types by default

* Accept any pin in AnyPin

* Add changelog and migration guide

* Fix tests and examples

* Undo rename of clone_unchecked
2024-09-05 14:14:51 +00:00
Dániel Buga
99bf346898
Remove the need to manually pass clocks around (#1999)
* Clean up passing clocks to drivers

* Update changelog

* Initialise Clocks in a critical section

* Fix calling now() before init

* Fix doc

* Fix esp-wifi migration guide

* Add safety comment

* Update tests
2024-09-04 14:13:51 +00:00
Kirill Mikhailov
9bec6a1806
Adding I2C HIL test (#2023)
* i2c hil test

* pin

* fmt

* Test

* WIP (gpio test left)

* Finalize the CODE part (to be cleaned up)

fmt

* Smaller cleanup

* cleanup

* rebase

* fix

* getting last chips ready

* Addressing reviews
2024-09-04 12:45:58 +00:00
Dániel Buga
447411fb58
Rework hal initialization (#1970)
* Rework hal initialization

* Turn sw interrupt control into a virtual peripheral

* Return a tuple instead of a named struct

* Fix docs

* Remove SystemClockControl

* Move software interrupts under interrupt

* Re-document what's left in system

* Update time docs

* Update sw int docs

* Introduce Config

* Fix tests

* Remove redundant inits

* Doc

* Clean up examples&tests

* Update tests

* Add changelog entry

* Start migration guide

* Restore some convenience-imports

* Remove Config from prelude
2024-09-02 13:38:46 +00:00
Dániel Buga
c7a7760b51
Implement timer conversion for some arrays (#2012) 2024-08-28 09:54:58 +00:00
Dániel Buga
8aa1a88a23
Prefer cfg_if (#2003) 2024-08-27 11:53:55 +00:00
Priit Laes
a41bc4cb3d
gpio: Make AnyPin, AnyInputOnlyPin, DummyPin available from gpio module (#1918)
Making these available straight from `gpio` aligns it with other Embassy
implementations (mainly nrf and stm32).

Signed-off-by: Priit Laes <plaes@plaes.org>
2024-08-26 18:30:24 +00:00
Dániel Buga
b4ccb359ef
HIL: Multiple featuresets & conditionally enable generic-queue feature (#1989)
* Conditionally enable generic-queue feature

* Allow specifying multiple feature sets and run all of them
2024-08-26 06:19:03 +00:00
Dániel Buga
ec130877b7
Disable RTT polling in HIL tests by default (#1960)
* Disable defmt-rtt by default

* Update i2s test based on changes done to async

* fmt

* Update readme

* Update more tests
2024-08-19 13:47:22 +00:00
Juraj Sadel
42bbdaeb4f
Add basic HIL test for GPIO that can be configured as pin for (#1963) 2024-08-19 11:43:59 +00:00
Dániel Buga
f95ab0def5
Simplify initialization APIs (#1957)
* Accept more types in embassy::init

* Apply the same treatment to esp-wifi

* Changelog

* Clean up

* Add doc examples

* Fix Alarm generic parameters
2024-08-16 16:33:29 +00:00
Jesse Braham
3215d93f53
Use peripheral ref pattern for OneShotTimer and PeriodicTimer` (#1855)
* Use the peripheral ref pattern for `OneShotTimer` and `PeriodicTimer`

* Update tests and examples to reflect changes in timer API

* Update `CHANGELOG.md`
2024-07-25 12:52:34 +00:00
Björn Quentin
1424f2a43d
Implement InterruptConfigurable (#1819)
* Implement `InterruptConfigurable`

* Fix doc-tests

* Clippy

* Fix lp_core_uart example

* CHANGELOG.md

* Have DEFAULT_INTERRUPT_HANDLER

* Fix docs

* Clippy

* Add `set_interrupt_handler` for WDT
2024-07-18 13:37:46 +00:00
Björn Quentin
a5be31fadc
Improve and use timer abstractions (#1753)
* Make esp-wifi timer agnostic

* Use timer-abstractions in embassy time driver

* Refactor

* Fix

* Fix

* Docs

* Adapt examples

* Adapt tests

* Refactoring

* Changelogs

* Fix example

* Adapt xtask

* Make CI pass

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-07-09 15:59:38 +00:00
Sergio Gasquez Arcos
e46e80b8c1
Enable C2 HIL (#1680)
* ci: Enable c2 hil

* docs: Update pins and add C2

* feat: Update C2 probe-rs args

* test: Update pins and disable failing tests

* docs: Update S3 wires

* ci: Enable C2 hil tests
2024-06-26 14:17:40 +00:00
Björn Quentin
b8af24071e
Add Flex/AnyFlex pin drivers (#1659)
* Add Flex/AnyFlex pin drivers

* CHANGELOG.md
2024-06-10 15:23:55 +00:00
Jesse Braham
48e3e912f3
Extract embassy support into esp-hal-embassy package (#1595)
* Extract embassy support into `esp-hal-embassy` package

* Update relevant packages/examples/tests to get CI green again

* Add back `defmt` support

* Re-export `Executor` and `InterruptExecutor` rather than making `executor` module public

* Document the `esp-hal-embassy` package

* Update `CHANGELOG.md`

* Hack together a "fix" for the `SYSTIMER` time driver

* Make `clippy` shut up
2024-06-03 11:27:20 +00:00
Juraj Sadel
60d39e9f33
GPIO: Use Level enum instead of plain bool in constructors (#1574)
* GPIO: Use Level enum instead of plain bool in constructors

* changelog
2024-05-22 12:37:03 +00:00
Scott Mabin
9acf72df33
Mention how handlers are run when drivers are moved across cores (#1568) 2024-05-21 08:22:35 +00:00
Sergio Gasquez Arcos
3c05759556
Enable gpio::test_gpio_interrupt for Xtensa targets. (#1555)
* docs: Update probe-rs

* tests: enable test_gpio_interrupt for Xtensa targets
2024-05-15 09:13:43 +00:00
Björn Quentin
2faa2654cb
GPIO Refactoring (#1542)
* GPIO Refactoring

* CHANGELOG.md

* Addressed review comments

* Use `Level` instead of plain bool in public API

* Let drivers enable analog functions
2024-05-15 08:49:33 +00:00
Scott Mabin
f32565b4af
Embassy enable thread and interrupt by default, enable embassy when building docs (#1485)
* Remove interrupt and thread executor embassy features

* Reserve sw interrupt 3 (4) instead of 0 for multicore systems with the embassy feature enabled

* Remove uneeded #[feature()] from examples

* Fix HIL tests

* Add thread mode context id and fix up examples

* improve embassy module docs

* changelog

* fixup hil tests

* Fixup usb examples
2024-05-02 15:58:04 +00:00
Sergio Gasquez Arcos
edd03717d2
Enable C3, H2, S2 and S3 HIL (#1513)
* ci: Enable C3, H2, S2 and S3 HIL tests

* feat: Disable H2

* test: Disable S2

* ci: Update test folder

* docs: Update setup

* revert: Revert S2 changes

* ci: Update hil tests targets

* test: Adapt uart test for S2

* ci: Enable H2 HIL

* feat: Filter unsupported targets for the tests failing

* test: Filter failing targets

* ci: Remove the test folder

* test: Filter S2

* feat: Add supported targets

* feat: Remove TODOs and format code

* docs: Remove outdated comment

* feat: Add run-elfs xtask subcommand
2024-05-02 15:35:23 +00:00