2342 Commits

Author SHA1 Message Date
Dániel Buga
3d7d6f8453
Deduplicate error handling (#3481) 2025-05-09 09:15:09 +00:00
Dániel Buga
e2a9fc7437
Try to fix timeout errors when the I2C driver is preempted (#3458)
* Add test case

* Check completion before error
2025-05-08 15:05:22 +00:00
Björn Quentin
29060aee6a
Enable problem-matchers in CI (#3480) 2025-05-08 13:07:51 +00:00
Dániel Buga
8271760498
Increment beta version (#3470) 2025-05-08 12:25:57 +00:00
Björn Quentin
123544deb7
Group CI output (#3476) 2025-05-08 12:22:50 +00:00
Benedikt
710a0b996f
RMT: Simplifications and fixes for extended channel RAM (#3453)
* RMT: Remove duplicate conditionals

The next check,

    config.memsize > NUM_CHANNELS - T::CHANNEL

just below includes this case and exits with the same error.

* RMT: move chip-specific code to chip_specific modules

Moves configure_clock and clear_memsizes from Rmt methods to the chip_specific
sub-modules:

- configure_clock dispatches to functions from chip_specific anyway,
  using the same #cfg attributes as the chip_specific module
- clear_memsizes also uses the same #cfg attributes, and it deals with
  low-level register access, which is generally contained in the chip_specific
  module

* RMT: small refactor of divider calculation using let-else

The same check as before, but slightly more concise, and getting rid of
the explicit cast.

* RMT: simplify is_memory_blocks_available and set_memory_blocks_unavailable

by removing unnecessary checks for special-case values that actually behave the
same as the general case that is handled in the loops

* RMT: merge is_memory_blocks_available and set_memory_blocks_unavailable

Both are only used in conjunction anyway.

There's a TOCTOU issue here: ChannelCreator is Send + Sync, so it can be
used from ISR context or on different cores for multicore targets.
This commit does not address that yet, but is a first step to fixing the
race condition, which would require making the check-then-modify atomic
(atomic per channel would probably be sufficient).

* RMT: move reserve_memory from trait to chip_specific module

Mainly, this also fixes incorrect indexig of ch_tx_conf0, ch_rx_conf0
for some chips (esp32s3, esp32c3, ...).

It also allows for some deduplication of the logic in reserve_memory.
Generally, since this function deals with the collection of all channels
rather than just a single one, it feels more natural to move it to the
module rather than the per-channel trait.

* RMT: avoid race condition via critical_section

This is not a great solution, but resolving this in a better way seems
to require more design work: The PAC crates don't seem to provide atomic
CAS operations on registers, thus it is not easily possible to reserve
the memory belonging to another channel than the current one without
causing a race condition: Another channel could be used to concurrently
reserve the same memory, either from an ISR context, or from another
core on multi-core chips.

* RMT: Release channel RAM on Channel drop

This should allow it to be re-used, either by other subsequent channels,
or by the initial channel if it was used for a non-'static lifetime and
is re-initialized.

* RMT: add global STATE and use it to control channel RAM access

Right now, this removes the use of critical_section previously
introduced as a stopgap solution to a race condition.

It will generally be useful to track state in a global static atomic for adding
fully interrupt-driven transfers later on.

* RMT: Fix regression form #3292 where tx transaction doesn't write
enough data

The idea is to fill half of the available RAM in on each threshold
event. Increasing the amount of available RAM in this calculation was
forgotten when adding support for extended channel RAM.
2025-05-08 12:05:06 +00:00
Dániel Buga
80772534a5
Fixup changelog (#3474) 2025-05-08 10:10:33 +00:00
Björn Quentin
ca07fbc5df
Make esp-config structs de-serialization friendly (#3455)
* Make esp-config's structs de-serialization friendly

* Simplify ConfigOption's constructor

* CHANGELOG.md

* Make sure `esp-wifi/build.rs` formats correctly

* Typo

* Run tests, again

* Tests
2025-05-08 08:01:21 +00:00
Dániel Buga
d0eb59d47d
I2C: clean up, validate address and reset state machine/fifos before in the same place (#3466)
* Simplify I2C future

* Wait for completion with a real timeout

* Reset before a new transmission
2025-05-08 07:35:56 +00:00
Sergio Gasquez Arcos
a3703651cc
feat: Update Xtensa Rust (#3467) 2025-05-07 14:49:06 +00:00
Dániel Buga
9c0512c1be
Hopefully innocent I2C-related cleanups (#3460)
* Simplify test

* Clean up
2025-05-07 13:47:58 +00:00
Dániel Buga
eb7cbfcd08
Use esp-metadata to detect BT/WIFI availability (#3468) 2025-05-07 13:37:15 +00:00
Jesse Braham
e5ea7e35cd
Refactor xtask subcommands to be group by common functionality (#3457)
* Create `command` submodule, extract build-related args/actions

* Extract run-related args/actions

* Fix clippy warnings

* Update `README.md` for xtask package

* Fix order of positional arguments for examples

* Update workflows and cargo aliases

* Inline function which is only called in one place

* Update HIL workflow
2025-05-07 09:32:51 +00:00
Björn Quentin
78bd99e653
Use variable in the format string (#3463) 2025-05-07 06:50:22 +00:00
Jesse Braham
63ed40c368
Update eFuse field definitions (#3440)
* Copy eFuse field definitions from `espflash` repo, make required changes to get building again

* Clean up functions for reading eFuse fields a bit

* Make reading the MAC address chip-agnostic

* Remove eFuse field generation from `xtask` package

* Remove `read_field_be` function, as it's not really required

* Fix clippy lint errors

* Update `CHANGELOG.md`

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-05-06 08:39:35 +00:00
Dániel Buga
5df246c702
Rely on esp-metadata for chip feature check (#3447) 2025-05-06 08:11:53 +00:00
Dániel Buga
c706ed220e
esp-println: Timestamp for defmt (#3446)
* Implement timestamp for defmt

* Fix build
2025-05-05 14:44:11 +00:00
Dániel Buga
8011a30bd0
Fix write_str returning early (#3452) 2025-05-05 13:41:07 +00:00
Dániel Buga
16897bb68d
Tweak features and dependencies (#3425)
* Group optional dependencies

* Separate version from crate name

* Restore defmt-log mutual exclusivity

* Gate ufmt

* Remove usb-device

* Feature-gate unsable dependencies behind unstable

* S2: assume single core for portable-atomic

* Clean up feature flag docs

* Sack debug

* Fix clippy

* Update examples

* Fix usb-otg feature

* Fix fmt

* Add version to log dep

* Also mark bluetooth private

* Correct changelog/MG

* Clean up esp-hal-embassy

* Clean up ieee802154

* Clean up esp-println

* Move the timestamp function up

* Move info from readme to feature docs

* Clean up esp-storage

* Clean up esp-wifi

* Fix examples

* Add a note for the private features
2025-05-05 11:33:55 +00:00
Dániel Buga
c255604d4b
esp-alloc: Fix docs (#3451) 2025-05-05 08:45:19 +00:00
Björn Quentin
743664dd6b
esp-wifi: Support calibration modes other than FULL (#3383)
* Have one place for phy calibration

* Offer phy calibration modes other than FULL

* Add config for initial power save mode

* CHANGELOG.md

* Fixes after rebase

* Remove initial-power-save-mode

* Rebase adjustments
2025-05-01 12:54:50 +00:00
Dániel Buga
f497b75ee8
Clean up esp_hal_embassy timebase documentation (#3444)
* Clean up systimer conditional cfgs

* Seal and clean up e-h-embassy timebase

* Remove separate collection trait

* Panic if EmbassyTimer::init is called multiple times

* Changelog

* Make documentation respect ESP32
2025-05-01 09:57:29 +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
5c97eaf8ba
Fix panic on long waits (#3433)
Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-04-29 08:00:27 +00:00
Dániel Buga
9a04b258bf
esp-storage: Remove nor-flash and storage features (#3431) 2025-04-29 07:52:46 +00:00
Jan Steinke
2c306e7bf6
ESP32h2 ADC calibration (#3414)
* implement basic calibration method

* implement line and curve calibration method

* format code

* add change to CHANGELOG

* review comments

* remove unneeded sub `cfg`

* cleanup unused bits

* format code

* fix clippy issues

* format code

* remove trailing 0 in float

* add semihosting dependency to risc-v chips

* remove semihosting from feature config
2025-04-29 06:56:05 +00:00
Dániel Buga
611bdc6dd7
Update embedded-test (#3432) 2025-04-28 11:42:03 +01:00
Sergio Gasquez Arcos
ab18d89470
fix: Nightly issues (#3434) 2025-04-28 11:41:35 +01:00
Dániel Buga
68ffb747db
Update embedded-test (#3432) 2025-04-28 11:29:58 +01:00
Dániel Buga
ddbac7b12d
Make nb optional, remove void (#3418) 2025-04-25 10:42:27 +00:00
Dániel Buga
cb4b09fb62
Rework GPIO matrix impl (#3395)
* WIP

* Clean up init_gpio

* Expand docs a bit

* Remove Input/OutputConnection

* Not everything has PCNT and it's not important for the example

* Remove Frozen, enable input when creating the signal

* Hide fields, add getters

* Update MG

* Add force GPIO matrix fns

* Fix formatting

* Mention latency in the docs

* Rename number to gpio_number

* Deduplicate pin setup code

* Reword associated peripheral

* Rename with_inverted_input/output

* Remove link to doc-hidden OutputSignal

* Fix link syntax
2025-04-25 10:33:29 +00:00
Dániel Buga
fec36e3be3
Implement ReadReady and WriteReady (#3423) 2025-04-25 07:54:58 +00:00
Dániel Buga
e0c4ae75d2
Fix nightly woes (#3422) 2025-04-25 07:17:59 +00:00
Dániel Buga
8f717c49bb
Move some code to non-generic impl (#3417) 2025-04-24 14:58:17 +00:00
Dániel Buga
b1f487093b
Update dependencies (#3416) 2025-04-24 13:41:20 +00:00
Björn Quentin
11ff06a368
Fix esp32 coex (#3403)
* Make sure to enable relevant interrupts

* Fix more

* Make `current_runlevel` public

* Check that interrupts are enabled when initializing

* Try to be more honest in `is_in_isr`

* Adjust log levels

* Really fix ESP32 COEX

* Improve COEX example

* fmt

* CHANGELOG

* CHANGELOG

* Clarify on `esp_bt_controller_config_t`

* Take INTENABLE into account

* Test esp-wifi init fails

* Simplify test code

* Clarify comment

* fmt

* Rename

* Adapt the test

* Revert unrelated changes (esp_bt_controller_config_t)

* Align Xtensa (current_runlevel)

* Additional test

* Change test
2025-04-24 11:39:07 +00:00
Björn Quentin
934bf818fc
Fix s2 enterprise wpa (#3406)
* Don't use `strcasecmp` from ROM

* fmt

* CHANGELOG
2025-04-24 08:37:04 +00:00
Dániel Buga
ab73f43d7d
Mark methods as unstable to prevent unused warnings (#3409) 2025-04-23 08:53:01 +00:00
Kirill Mikhailov
04b71139be
disconnect unused connections (#3407) 2025-04-22 15:50:09 +00:00
Kirill Mikhailov
ec6aec4b59
Fix I2C HIL tests (#3405) 2025-04-22 13:32:58 +00:00
Dániel Buga
ffbcae162a
Simplify Flex (#3387)
* Simplify Flex

* Rename functions
2025-04-22 12:30:34 +00:00
Björn Quentin
4bc9ef2f5b
Check for ST_TOUT / MAIN_ST_TOUT (#3333)
* Check for ST_TOUT / MAIN_ST_TOUT

* Fix & CHANGELOG

* cfg gate

* Field renaming in PACs

* Introduce FsmTimeout type

* `new_const`

* Review comments

* Async I2C tests

* Remove FSM timeout for S2

* Add test

* Don't run `async_test_timeout_when_scl_kept_low` on S2 - we know it fails

* Fix

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-04-22 11:11:11 +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
df6aa9c18f
Rename ESP_HAL_CONFIG_PLACE_SPI_MASTER_DRIVER_IN_RAM (#3402)
Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-04-22 09:09:07 +00:00
liebman
d5f8f297ab
parl_io: make TxPins, RxPins & ConfigurePins public (#3398)
* parl_io: make TxPins, RxPins & ConfigurePins public

* fmt

* CHANGELOG
2025-04-22 07:53:36 +00:00
Dominic Fischer
3a06e2553d
Add all SPI signals to Info struct (#3396)
* Add all SPI signals to Info struct

* cfg away opi signals

* spi_octal
2025-04-22 07:46:06 +00:00
Dominic Fischer
b526bdc6b0
Fix incorrect doc on LCD_CAM (#3397) 2025-04-22 06:49:42 +00:00
Dániel Buga
bc35b6f2fd
Deduplicate pin setters (#3394) 2025-04-16 10:20:29 +00:00
Björn Quentin
8c7531253a
Ota partition support (#3354)
* Add basic OTA functionality

* Return Result from Ota::new

* Restructured

* Enable `ota` by default

* Include metadata to let tooling know we need an ota-data partition

* More docs

* CHANGELOG.md

* Make OSX happy to run tests

* Another try

* OSX...

* OSX, again

* Add tests

* Prefer ROM CRC function

* Unconditionally include the "ota" feature

* Renaming and docs

* de-noise tests

* De-duplicate

* Address more review comments

* Review comments and Clippy
2025-04-16 09:56:22 +00:00
Dominic Fischer
bfe6a1c689
Tidy up Camera according to latest guidelines (#3375)
* Tidy up `Camera` according to latest guidelines

* fmt

* enum
2025-04-16 09:19:49 +00:00