340 Commits

Author SHA1 Message Date
Juraj Sadel
c6437c7a44
Update examples and qa-test to new bootloader (#3541) 2025-05-26 10:37:41 +00:00
Björn Quentin
51e23fe14d
Fix ESP32 PSRAM (in combination with esp-storage) (#3524)
* Fix ESP32 PSRAM (in combination with esp-storage)

* CHANGELOG.md

* Cleanup

* Add test
2025-05-23 14:28:18 +00:00
Kirill Mikhailov
c53e0bf788
UART: Adding HW and SW flow control config option (#3435)
* Add HW and SW flow control option

* Fmt + warnings

* changelog entry

wrong unstable macro

* address reviews

* get away with using 1 pin only

* unnecessary function call

* Address reviews + use "byte" instead of misleading "character" (at_cmd)
2025-05-21 10:36:07 +00:00
Benedikt
fe25980e53
RMT: Minor cleanups, simplify address calculations, extend HIL test (#3477)
* RMT: simplify/avoid a few cfg attributes

* RMT: factor address calculation into new function channel_ram_start()

* RMT: don't repeatedly read *ChannelInternal::memsize()

Moving this into separate variable greatly increases readability of the
code. It also avoids unnecessary repeated volatile reads of the
corresponding register.

* RMT: rework SingleShotTxTransaction offset calculation

This is not a big simplification yet, but will help will help with
simplifying the somewhat obscure `ram_index` calculation.

* RMT: rework SingleShotTxTransaction offset calculation, part 2

This removes the somewhat hard to parse
    let ram_index = (((self.index - memsize) / (memsize / 2)) % 2) * (memsize / 2);
calculation, by resorting to the ping-pong method also used by the idf
code.

Importantly, even with the previous code, ram_index cannot in fact assume any
possible in-range value in channel RAM, but only either 0 or memsize / 2
(except at the end of a transaction, when there's no data left).

Thus we can update it via
    ram_index = memsize / 2 - ram_index
such that will alternate ("ping-pong") between 0 and memsize / 2.

* RMT: error out on config.memsize == 0

* RMT: fix bogus cfg attributes

This is inside of a #[cfg(any(esp32, esp32s2))] block, so esp32s3 can
never happen: The result of nested cfg attributes was still correct, but
writing it like this doesn't make any sense.

* RMT: remove unnecessary integer literal type annotation

* RMT: remove spurious code from clear_interrupts()

- update() is known to be a no-op here
- For other chips, resetting pointers and setting mem_owner is not done
  in clear_interrupts(), but in start_rx. clear_interrupts() is only used in
  situations where either the channel was unused before (i.e. should be
  stopped), or we explicitly called Self::stop() before. Thus, match
  other chips here.

* RMT: clear mem_owner in start_tx

While I haven't seen this happen, it appears to be possible that one of
the subsequent channels (or even the current channel) was used for RX before.
Thus, ensure that mem_owner is set correctly for TX.

* RMT: small refactoring

There should be no functional change, but this should make it even more
obvious that the return value is exactly the number of codes written.

* RMT: in SingleShotTxTransaction, improve error handling

I haven't seen any error here in practise, but it seems that this could
have locked up in the `while !is_threshold_set()` loop before in case of
an error or early stop code in the data.

* RMT: avoid one register access

* RMT: update HIL tests to use wrapping and extended RAM

* RMT: address review regarding data-writing loops

Make the code less startling by performing writes to the hardware in a
more imperative style via the for-loop; slightly refactor slice
splitting.

* RMT: Update changelog
2025-05-20 13:11:26 +00:00
Dániel Buga
aeaab9a95b
Give more time to ECC tests (#3500) 2025-05-19 14:46:06 +00:00
Dániel Buga
74de9d65d6
Update allocator_api2 (#3487) 2025-05-19 07:38:07 +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
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
5df246c702
Rely on esp-metadata for chip feature check (#3447) 2025-05-06 08:11:53 +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
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
68ffb747db
Update embedded-test (#3432) 2025-04-28 11:29:58 +01: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
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
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
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
Dániel Buga
11ba2509d2
Peripheralize DMA channels (#3372) 2025-04-14 09:09:54 +00:00
Dániel Buga
014db9bc7e
Define unstable config options (#3365)
* Add stability to config options

* Reject unstable options

* Add note to docs

* Use enum validator in e-h-embassy

* Generate a list for enumerated values

* Don't allow line-wrapping headers

* Center default/allowed values

* Changelog

* Display stability under name

* Remove - from Allowed value when option has no constraints

* Mark more options as unstable

* Include a hint in the unstable error
2025-04-11 15:00:13 +00:00
Dominic Fischer
ba944a2931
Replace ParlIoFullDuplex/ParlIoTxOnly/ParlIoRxOnly with just ParlIo (#3367) 2025-04-11 07:52:04 +00:00
Dominic Fischer
353950dbdf
Change ParlIo driver to use a config struct (#3359)
* Change `ParlIo` driver to use a config struct

* missed a spot
2025-04-10 09:51:55 +00:00
Dominic Fischer
7b4b41c0ed
Add DMA memcpy support to the S2 (#3352)
* Expose CopyDmaChannel

* Add DMA memcpy support to the S2

* whoops, esp32 is a thing

* clear can be a no-op

* sigh

* rust

* enable the DMA channel

* The S2 wants RX first...

* fmt
2025-04-09 13:57:15 +00:00
Dominic Fischer
f87f8846b2
More PARL_IO HIL tests (#3339)
* More PARL_IO HIL tests

* adjust

* adjust

* tweak

* tweak

* give up on the H2

* remove flakey test

* Update CHANGELOG.md

* add comment
2025-04-09 10:33:41 +00:00
Dániel Buga
0a4089b4d3
Refactor GPIO pin types (#3349) 2025-04-09 08:20:37 +00:00
Björn Quentin
523bd381eb
Validate 7-bit I2C addresses (#3343)
* Validate 7-bit I2C addresses

* add test

* CHANGELOG.md

* Docs

* Include address in `Error::AddressInvalid`

* Fix

* CHANGELOG.md

* Revert CHANGELOG change

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-04-08 11:35:36 +00:00
Dominic Fischer
d6c6894afe
Make ParlIo driver construction more consistent (#3345)
* Make `ParlIo` driver construction more consistent

* missed a spot
2025-04-08 08:37:33 +00:00
Dominic Fischer
96daf998c8
Migrate DMA memcpy driver to newer DMA API (#3329)
* Migrate DMA memcpy driver to newer DMA API

* remove irrelevant HIL test

* Relax descriptor lifetime
2025-04-08 08:10:32 +00:00
Dominic Fischer
4c3c4253ed
Migrate SPI Slave to new DMA API (#3326)
* Migrate SPI Slave to new DMA API

* fix bad merge
2025-04-03 11:30:55 +00:00
Dániel Buga
ae60ceb8bc
Remove restrictive three-wire check (#3325) 2025-04-03 10:41:27 +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
Dominic Fischer
5cec008506
Refactor I2S driver to take DmaDescriptors later in construction (#3324)
* Refactor I2S driver to take `DmaDescriptor`s later in construction

* unused import

* stray test
2025-04-03 07:53:56 +00:00
Dániel Buga
76083289cf
Annotate macros with collapse_debuginfo(yes) (#3323)
* Enable esp-wifi/defmt if tests want defmt

* Annotate log macros with collapse_debuginfo
2025-04-02 14:26:22 +00:00
Dániel Buga
65c1ddc31f
[esp-alloc] Implement allocator_api2 (#3318)
* Add allocator_api2, AnyMemory

* Implement more allocators

* Document

* Sub PR number

* Fix doc formatting

* Remove redundant checks

* Test failure case in try_reserve
2025-04-02 12:41:10 +00:00
Dániel Buga
739e203f39
Fix inverting pins (#3312)
* Merge tests

* Add test case with inverted pins

* Connect signal before converting to AnyPin
2025-03-31 09:40:55 +00:00
Tethys Svensson
7d07f1b791
Fix off-by-one in the allowed range of the spi clock calculations (#3266)
* Fix off-by-one in the allowed range of the spi clock calculations

* Update CHANGELOG

* Add test to verify calculation

* Use actual frequency limits in validation

* Rename variables

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-03-28 16:18:34 +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
Dominic Fischer
80d548c5f0
ESP32: Enforce required pointer alignments in DMA buffers (#3296)
* ESP32: Enforce required pointer alignments in DMA buffers

* try fix HIL
2025-03-25 14:43:47 +00:00
Dominic Fischer
ae56074e95
SpiDmaBus no longer adjusts the DMA buffer length for each transfer (#3263)
* `SpiDmaBus` no longer adjusts the DMA buffer length for each transfer

* imports

* lint

* chunking is hard

* Also check received bytes

* Do not check descriptors when copying received data

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-03-24 13:47:30 +00:00
Dániel Buga
7c159b6070
Fix typo (#3256) 2025-03-14 11:46:29 +00:00
Dániel Buga
bc28f64f22
SPI: stop transfer if Spi::transfer_in_place is cancelled (#3242)
* Move OnDrop

* Abort async transfer

* Finish sentence
2025-03-14 09:26:39 +00:00
Björn Quentin
d3f3d81d9e
Prepare linker scripts for ESP-IDF application descriptor (#3124)
* Prepare linker scripts for app-desc

* Explain flash offset

* Explain `rotext_dummy`

* Test app-descriptor

* fmt

* embedded-storage
2025-03-06 10:23:26 +00:00
Dániel Buga
f535f1c6fb
Fix flip-link, make SSP configurable (#3203)
* Test flip-link

* Add todo

* Rebuild if linker files change

* Let espsegs show .stack

* Try to fix flip_link

* Changelog

* Make SSP configurable

* Substitute config values
2025-03-05 14:09:17 +00:00
Dániel Buga
d9c32d5c29
Test that all PSRAM is unsable (#3210) 2025-03-05 10:46:54 +00:00