2497 Commits

Author SHA1 Message Date
Dániel Buga
2a06d38141
Only run the selected example, not all of them (#4057) 2025-09-05 09:04:04 +00:00
Dániel Buga
a84d3cc89f
Make timekeeping the driver's job (#4047) 2025-09-05 07:31:40 +00:00
Dominic Fischer
a5f929a663
ESP32-S3: Add RtcI2c driver (#4016)
* ESP32-S3: Add RtcI2c driver

* limit cfg

* un-hide traits

* fix macro and doc

* Document driver

* fix doc

* Add HIL test

* use builder lite for timings

* no-const

* review comments
2025-09-04 20:58:33 +00:00
Dániel Buga
5e13146842
Route logs to stdout (#4054) 2025-09-04 17:41:04 +00:00
Dániel Buga
cf2b162517
Add queues to esp-preempt (#4043) 2025-09-04 15:26:51 +00:00
Kirill Mikhailov
38fd991ff7
More cleanup in esp-radio (#4040)
* More cleanup in `esp-radio`

* misc

* address reviews

* docs update

* fmt
2025-09-04 14:03:19 +00:00
Dániel Buga
d9f6d7d73e
Fix endgroup syntax (#4051) 2025-09-04 13:13:02 +00:00
Dániel Buga
1c4db2f339
Fix failing ESP32 test case (#4036)
* Remove unnecessary allow

* Don't assume timing in HIL test
2025-09-04 12:21:03 +00:00
Juraj Sadel
34b908dc56
Remove wifi_state and split WifiState into WifiStaState and WifiApState (#4046)
* Remove wifi_state adn split WifiState into WifiStaState and WifiApState

* MG

* changelog

* review
2025-09-04 11:28:00 +00:00
Dániel Buga
227ad1fced
Fix example selection (#4045) 2025-09-04 11:22:08 +00:00
Dániel Buga
7305bc08dc
Add wifi init test case, fix logic bug in wifi::new (#4050) 2025-09-04 11:10:40 +00:00
Fun Maker
46eed04403
Add Config structure for I2s (#3985)
* Add Config structure for I2s

* Add apply_config for I2sTx/I2sRx
2025-09-04 10:16:49 +00:00
Dániel Buga
2e958d2bb7
Move mutexes to esp-preempt (#4041) 2025-09-04 07:38:43 +00:00
Dániel Buga
cc91bb1c9e
Move semaphore implementation to esp-preempt (#4038) 2025-09-03 14:21:47 +00:00
Benedikt
a13def7df6
RMT: Type-erase channels (#3980)
* RMT: add HIL test that exercises all channels

to ensure that there are no issues with channel/register indexing; see
also the code comments.

no user-facing changes

* RMT: store ch_idx instead of channel number

`ConstChannelAccess` and `DynChannelAccess` used to store the channel number
and have a `Direction` generic parameter.
However, there are invalid combinations of `Direction` and the channel
number on some chips (e.g. on esp32c3, there is no channel with (Tx, 2),
because channel 2 and 3 only support Rx).

In constrast, the tuple `(Dir, ch_idx)` also uniquely identifies a
channel and its configuration, and any combination of it is valid as long as the
channel index is in bounds.

This makes it somewhat easier to work with; in particular, it will allow
removing bounds checks on ch_idx in a later commit by replacing
`ch_idx: u8` with an enum type.

This also refactors the `async_interrupt_handler` accordingly.

This is user-visible via the `ConstChannelAccess` type, however a later
commit in this PR will remove that entirely.

* RMT: elide bounds checks via ChannelIndex enum

If the channel index is not known at compile time in a given function,
the compiler will insert bounds checks on

- indexing the STATE global
- register access via the PAC

The compiler seems to be able to deduplicate them since low-level
functions are mostly inlined, but each function will retain at least one
bounds check.

This change helps the compiler to elide these checks by using a custom
type for channel indices that can only take values for which a channel
exists.
Specifically, this uses an enum to serve as a refinement of u8 to help
the compiler restrict value ranges. Due to inlining, this restricted
value range is propagated by the compiler until the potential bounds checks,
even if there's intermediate cast to u8,
cf. https://github.com/rust-lang/rust/issues/109958

There are no user-facing changes. (`ChannelIndex` is `pub` because it
appears in a `[doc(hidden)]` trait member.)

* RMT: always type-erase channels

- remove the `Raw` generic on `Channel`: This simplifies the types,
  should have negligible performance impact (helped by elided bounds
  checks via the recently introduced `ChannelIndex` enum), and greatly
  reduce code size if several channels are used (by avoiding
  monomorphization per channel)

- this also changed the arguments to configure_(tx,rx)_channel such that
  they don't contain generics, again avoiding code bloat due to
  monomorphization

This requires user code to change type annotations for channels and
transactions, and remove any manual type erasure (via `channel.degrade()`).

* RMT: impl blocking tx/rx methods directly on Channel

There's now only a single type that should implement these methods due
to erasing the channel index const generic, so the indirection via a
trait serves no purpose. Implementing methods directly on the channel
probably also helps to make the docs more discoverable.

This requires user code to remove the `TxChannel` and `RxChannel`
imports.

* RMT: impl async tx/rx methods directly on Channel

There's now only a single type that should implement these methods due
to erasing the channel index const generic, so the indirection via a
trait serves no purpose. Implementing methods directly on the channel
probably also helps to make the docs more discoverable.

This requires user code to remove the `TxChannelAsync` and `RxChannelAsync`
imports.

* RMT: impl *ChannelInternal traits only on DynChannelAccess

rather than as a blanket impl for RawChannelAccess, which includes
ConstChannelAccess: We don't intend to perform any accesses via
ConstChannelAccess anymore, so enforce that.
We could also get rid of the traits entirely and directly impl their
methods for DynChannelAccess, but it seems somewhat useful to keep them
around to guarantee that the interfaces in both chip_specific modules
are consistent.

There are no user-facing changes here.

* RMT: remove `pub` on various internal types

that used to be visible somewhere in the API's trait bounds, but are not
part of the API themselves

This is user-visible, but user code should not have used these types in
the first place.

* RMT: rm ConstChannelAccess, RawChannelAccess, private DynChannelAccess

now that Channel has no `Raw: RawChannelAccess` type parameter:

- we don't need low-level channel methods to be implemented for
  ConstChannelAccess, since all accesses go through DynChannelAccess.
  Thus, remove the *ChannelInternal traits and implement their methods directly
  on DynChannelAccess
- none of these types need to be public (although one might consider
  actually making them public with an unsafe constructor to provide an
  unsafe low-level interface to the hardware)

This is user-visible (imports need to be removed; they're not used
anymore since the previous commit that always type-erased the `Raw`
parameter of `Channel`)

* RMT: changelog and migration guide for type-erased channels

* RMT: (review) remove stray comment

* RMT: (review) remove is_tx() from Direction trait

we can simply use the const item directly
2025-09-03 12:15:51 +00:00
Dániel Buga
99e2b936df
Introduce esp-sync, avoid critical_section like the plague (#4023)
* Introduce esp-sync

* Avoid critical_section as much as possible
2025-09-03 09:34:18 +00:00
Juraj Sadel
dcdf0ba61f
remove dead link (#4027)
Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-09-03 09:20:56 +00:00
Dániel Buga
47e336f25d
Remove esp-backtrace from hil tests (#4035) 2025-09-03 08:22:20 +00:00
Björn Quentin
ec22515d05
Don't talk too much about xtasks (#4034) 2025-09-03 07:06:30 +00:00
Juraj Sadel
fe0a04517f
General esp-radio cleanup (#4017)
* General esp-radio cleanup

* changelog

* MG

* fix build error

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-09-02 16:48:17 +00:00
Fernando Pérez Lara
f2bae5a923
Use div_ceil for buffer size calculation (#4022)
* Use div_ceil for buffer size calculation

Replace manual ceiling division with Rust's built-in div_ceil method for
improved readability and standard library usage in DMA buffer allocation
macro.

* Update CHANGELOG

* Cast buffer size to usize in div_ceil calculation
2025-09-02 16:04:51 +00:00
Björn Quentin
a337554ea1
Make internals private (#4029)
* Make internals private

* CHANGELOG.md
2025-09-02 15:57:36 +00:00
Dániel Buga
01a01ba99e
Select example if none was specified (#4024) 2025-09-02 11:56:55 +00:00
Dániel Buga
60248d2c2f
Fix devguide (#4020) 2025-09-02 07:10:50 +00:00
Dániel Buga
28204ac970
Cpu-driven SHA work queue (#4013) 2025-09-02 06:54:31 +00:00
Kirill Mikhailov
1a5c79ebc7
swap the SDA/SCL order in HIL tests (S2/S3) (#4018) 2025-09-01 16:00:22 +00:00
Juraj Sadel
5f0f7cd573
Fix esp-wifi examples (#4014) 2025-09-01 12:54:29 +00:00
Dániel Buga
55d8228987
Backtrace tweaks (#4012)
* Disallow multiple halt methods

* Warn for nonsense config

* Use DRAM range from metadata
2025-09-01 12:53:02 +00:00
Sergio Gasquez Arcos
af1956d477
[esp-backtrace]: Only halt cores when using the halt-core feature (#4010)
* feat: Only halt cores when using the halt-core feature

* docs: Update changelog

* feat: Remove p4 code

* feat: Use a cs arround the loop

* feat: Only define halt method when required
2025-09-01 11:11:47 +00:00
Dániel Buga
cc50c89a20
Enable UHCI on S3 and C3 (#4011) 2025-09-01 09:56:57 +00:00
Björn Quentin
854941f1b0
Integrate 802.15.4 into esp-radio more (#4003)
* Integrate 802.15.4 into esp-radio more

* Fix H2

* fmt

* Fix

* Deny combination of 802.15.4 and Wi-Fi
2025-08-29 13:10:49 +00:00
Dániel Buga
0d3771cf3a
Enable UHCI on ESP32-H2 (#4008)
* Deduplicate test string

* Enable UHCI on GDMA devices
2025-08-29 11:18:15 +00:00
Dániel Buga
d9229c005f
S3/C3: Remove UHCI1 (#4007) 2025-08-29 10:43:50 +00:00
Dániel Buga
44b6c3daf1
Allow running specific tests (#4009) 2025-08-29 10:20:43 +00:00
Szybet
9fe02b819c
UART using DMA (via UHCI) (#3871)
* working rx

* very sketchy working tx

* uart uhci qa example

* move it

* cleanout

* read working great, write outputs the whole buffer

* tx working but rx can freeze

* fix freezes

* dont use vec

* cleaning

* async weird and not working

* async working?

* into async

* Apply suggested changes

* it compiles

* it also works with 'd

* split into seperate structs

* Add uart config configuration after uhci consumed it

* working Uhci normal

* again aaa sorry

* Apply suggested changes (That I knew how to implement)

* Add proper publicity, reimplement wrappers for internal functions using a macro, repair examples

* Moved to config, uhci normal example doesn't echo

* still not working

* hacky works normal

* apply suggested changes

* Initial docs

* fix messing up rx tx, still doesn't work

* Workaround, working but well

* change back to not pub (Maybe redo to public later, for now just to not mess with the workaround)

* now its working

* forgot to push

* Revert 2 commits, implement drop to showcase problem

* apply some suggested changes

* apply more suggested fixes (async/blocking)

* Everything works

* clearing out warnings

* handle errors

* merge from upstream, make it compile (not sure)

* Apply almost all suggestions

* re add wait for done

* Move errors out of wait_for_done, formating, changelog

* Apply suggested changes

* apply lint suggestions

* docs

* No longer public

* hil tests, rx tx transfer

* implement split

* forgot to format

* apply suggested changes

* Add top level module doc

* cicd now working?

* format, cicd maybe now

* apply suggestion

* format fix

* modify to write
2025-08-29 08:05:17 +00:00
Anthony Grondin
3f29f0571c
feat(example): Add SNTP example to show how to update Rtc to the current time (#3995)
* feat(example): Add SNTP example to show how to update Rtc

* Bump embassy-net to 0.7.0 for compatibility

* Revert back to task-arena to build on stable.
2025-08-29 07:45:04 +00:00
Dániel Buga
5f1c1feed9
I2C: Fix bus clearing/error recovery (#4000)
* Run test with multiple timeouts

* Align hw_bus_clear option with esp-idf

* Generate stop condition after HW bus clearing

* Tweak software bus clearing algo

* Make sure I2C is always reset

* Properly set finished flag even on timeouts

* Fix reset/clear interactions

* Add a note about blocking in Drop

* Add changelog entry
2025-08-28 19:56:28 +00:00
Björn Quentin
b5a7397134
Add a way to get/set calibration data (#4001)
* get/set calibration data

* Simplify

* Rename

* Update CHANGELOG.md
2025-08-28 16:30:34 +00:00
Björn Quentin
63d48b3c04
Use the ram macro instead of assuming the .rwtext section (#4005) 2025-08-28 15:26:22 +00:00
Jesse Braham
1ecb6f5f76
Add BLE examples using trouBLE, move some Wi-Fi examples to qa-test (#3999)
* Move `embassy_wifi_bench`, `wifi_bench`, and `wifi_csi` examples to `qa-test` package

* Remove blocking BLE example, replace Embassy example with trouble-based scanner

* Add BLE `bas_peripheral` example
2025-08-28 09:31:37 +00:00
Dániel Buga
588140a55f
Fix ESP32 crash (#3998)
* Move sleep state reset code to hal init

* Move RTC clock init into HAL init

* Set up RC clocks before XTAL

* Clear calibration start bit when done
2025-08-27 13:03:29 +00:00
Juraj Sadel
6f713c357b
API improvements (#3994)
* API improvments

* MG and changelog
2025-08-27 12:51:25 +00:00
Dániel Buga
e42f7d2e06
More clock refactor (#3993)
* Remove duplicate constants

* Metadata-ify some clock frequencies

* Changelog
2025-08-27 08:50:34 +00:00
Juraj Sadel
e6cdd8eb3c
Add xtask command check-unused-deps and remove unused deps/features (#3967)
* Add xtask command check-unused-deps and remove unused deps/features

* fix changelog

* reviews, move check into nightly-ci

* reviews

* readd document-features to esp-preemt

* Just cargo machete
2025-08-27 08:48:58 +00:00
Dominic Fischer
3f3af9363a
Expose more Camera config options (#3996) 2025-08-27 08:19:35 +00:00
Dominic Fischer
d21e64e9a2
Align I8080 driver pin configurations with latest guidelines (#3997) 2025-08-27 07:46:05 +00:00
Dániel Buga
b62679a175
WDT cleanup and fix tests (#3992)
* Configure WDTs while disabled, clean up

* Wait for less time, disable WDT after test
2025-08-26 14:47:57 +00:00
Dániel Buga
b8b7793bd9
Move SHA algos to metadata (#3991) 2025-08-26 14:38:48 +00:00
Björn Quentin
5089c291bf
ESP32: Enable full 4M of PSRAM (#3990)
* ESP32: Enable full 4M of PSRAM

* CHANGELOG.md

* ESP32: Expose psram_vaddr_mode

* Update esp-hal/src/psram/esp32.rs

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

* Update esp-hal/src/psram/esp32.rs

* Fix the fix

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-08-26 13:01:37 +00:00
Dániel Buga
30e5591e88
Tweak XTAL frequency options (#3983)
* Don't estimate XTAL with RC oscillator if not necessary. Accept wider range in HIL tests. Skip calibration if value is valid.

* Init clock before RTC domain
2025-08-26 11:31:41 +00:00