1754 Commits

Author SHA1 Message Date
Kirill Mikhailov
a4fe5e6e63
Adding a way to deinitialize the WiFi stack. (#2187)
* WIP

* cleanup

* WIP (BLE)

* WIP (BLE)

* c2 ble deinit doesn't work with ble alone, works in coex (WIP)

* fmt

* cleanup

* changelog entry

changelog entry

* WIP (do not check it)

 it's just to save things before weekend!

* polishing, refactor

* cleanup

* lint

* Addressing reviews

* address reviews

* utilize `EspWifiInitialization` in deinit

* example -> description

* reviews

* reviews

* fix memory leak + rebase

* typo

* fix

* init -> initialize

screwed up after rebase

* make esp32c6/h2 buildable again

* edit safety comment
2024-10-04 12:16:52 +00:00
Björn Quentin
00ad9b5eed
I2c: Inherent transaction function, lift size limits (#2262)
* I2c: Inherent transaction function, lift size limits

* CHANGELOG.md

* Simplify

* Fix

* Remove unnecessary lifetime

* Remove unused lifetime
2024-10-04 11:53:35 +00:00
Björn Quentin
18da679d8a
esp-wifi: Align default settings (#2251)
* Align esp-wifi defaults with ESP-IDF

* Check we assume the correct wifi-config defaults

* No WIFI-CONFIG for ESP32-H2
2024-10-04 09:34:42 +00:00
Dániel Buga
5a993fed38
Fix Rx/Tx order in SPI slave driver (#2272)
* Add basic test and fix SPI slave dma_transfer arg order

* Reset peripheral

* Add safe way to read signal value
2024-10-04 06:56:34 +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
Dominic Fischer
3e9a506c00
Move DMA buffers to a different file (#2267)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-10-03 11:12:20 +00:00
Dániel Buga
e033162ffd
Clean up (#2266) 2024-10-03 07:02:34 +00:00
Dominic Fischer
30aef580e3
Migrate Camera to a move based API (#2242)
* Migrate Camera to a move based API

* update

* update

* ManuallyDrop

* Add default channel to transfer struct

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-10-02 13:23:14 +00:00
Dominic Fischer
8789ca3c3d
Migrate I8080 driver to a move based API (#2191)
* Migrate I8080 driver to a move based API

* fmt

* comments

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-10-02 13:23:10 +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
f5b8e4b914
Remove SPI slave prelude (#2260)
* Remove SPI slave prelude

* Changelog

* Update esp-hal/src/spi/slave.rs
2024-10-02 06:23:54 +00:00
Dominic Fischer
8e9f6b5015
Erase DMA channel type from Camera and AesDma drivers (#2258)
* Provide AnyDmaChannel

* Erase channel in Camera and Aes

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-10-01 08:11:49 +00:00
Dániel Buga
ed51cd8c35
Only read value types from efuses (#2259)
* Only read value types from efuses

* Changelog

* Clean up remaining bool reads
2024-10-01 08:09:28 +00:00
Dominic Fischer
f1bedbe3dc
Split DMA RegisterAccess trait into RX/TX (#2249)
* Reduce macro usage in PDMA

* Split DMA RegisterAccess trait into RX/TX

* Move set_isr to Ext trait

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-30 13:32:18 +00:00
Dániel Buga
487de0ff22
Round up in delay_nanos (#2256) 2024-09-30 13:23:31 +00:00
Dániel Buga
fcc6375ba5
TWAI: Return error instead of crashing (#2255)
* TWAI: Return error instead of crashing

* Deduplicate interrupt handler
2024-09-30 12:51:27 +00:00
Björn Quentin
b8a4d5f9ff
Remove unused functions (#2254) 2024-09-30 12:07:41 +00:00
Juraj Sadel
11c73caf89
esp-wifi: Remove log feature from default features (#2253)
* esp-wifi: Remove log feature from default features

* changelog
2024-09-30 11:10:58 +00:00
Björn Quentin
fa66a43949
Update drivers (#2239)
* Update drivers

* Fixes

* Changelogs

* Actually remove timers when we should

* Have one waker for all events

* Prefer `swap_remove` over `remove`

* Really implement new coex fucntions for C3/S3

* Real implementation for `coex_schm_flexible_period_set` and `coex_schm_flexible_period_get`

* Mute warnings
2024-09-30 08:40:44 +00:00
Dániel Buga
0981c1b619
SPI peripheral signal cleanup (#2245)
* Compact peripheral description a bit

* Enable QSPI on ESP32 SPI3

* Remove SPI4 from ESP32S2

* Changelog

* Remove inaccurate comment
2024-09-27 17:03:18 +00:00
Dániel Buga
4422ed3ccf
DMA: Deduplicate descriptor operations (#2219)
* Deduplicate descriptor operations

* Reuse constructor

* Reuse linked list construction logic

* Extract count calculations into DescriptorSet

* Reuse more code in DescriptorChain

* Refactor DescriptorChain

* Move DescriptorSet next to DescriptorChain

* Restore comment

* Merge fns

* Implement error conversion

* Further cleanup

* Rearrange some code

* Add some docs

* Clippy

* Restore macro behaviour when requesting 0 descriptors

* Restore the buffer directly, instead of tracking where we read from

* Move validation back into the buffers

* Revert use in dma_tx_buffer

* Rename iterator methods

* Outline eof logic

* Don't set up descriptor flags before time, rename methods

* Hide DescriptorSet

* Remove block size from DescriptorSet

* Move comment

* Fix renamed references

* Address review comments

* Simplify received_data fns
2024-09-27 09:33:26 +00:00
Dániel Buga
f50c6fc071
Only lock once in is_slice_in_psram, use usize (#2241) 2024-09-27 08:06:46 +00:00
Dominic Fischer
66f6737697
Mark DMA buffer traits as unsafe to implement (#2213)
* Mark DMA buffer traits as unsafe to implement

* update doc

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-27 08:02:35 +00:00
Dominic Fischer
00d892b214
Add stop_transfer method to DMA driver (#2236)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-26 16:22:57 +00:00
Dániel Buga
c481c49888
Fix incorrect QSPI setup (#2231)
* Fix QSPI mode on non-ESP32

* Update tests to count pulses on pins separately

* Fix ESP32 addressing phase issue

* Use defmt's assert

* Set fastrd bit

* Apply pulldowns to define signal level when not driven

* Transfer address bits in data phase on ESP32

* Changelog

* Use a separate buffer for the address, make the workaround configurable

* Remove now-unnecessary additions

* Force SpiDma to remain Send

* Clarify wording, remove prefix

* Clean up manual register manipulation

* Fix byte order
2024-09-26 15:28:18 +00:00
Dominic Fischer
4377ec083f
Make DmaDescriptor methods public (#2237)
* Make DmaDescriptor methods public

* clippy

* comments

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-26 13:40:54 +00:00
Sergio Gasquez Arcos
fd57488ce3
Remove embedded-svc traits and feature (#2235)
* feat: Remove embedded-svc traits and feature

* docs: Changelog entry
2024-09-26 11:14:42 +00:00
Scott Mabin
6d96810c56
Allow building docs from different tags (#2218) 2024-09-26 08:55:54 +00:00
Björn Quentin
9321a34dbe
Reduce (unnecessary) rebuilds (#2232)
* Reduce (unnecessary) rebuilds

* Avoid redundant clone

* Prefer `.display()` over `.to_str().unwrap()`
2024-09-26 08:15:41 +00:00
Dániel Buga
feaf66847c
Fix warning: 'creating a shared reference to mutable static is discouraged' (#2230)
* Fix warning: 'creating a shared reference to mutable static is discouraged'

* Shorten lifetime of Clocks reference
2024-09-25 15:31:24 +00:00
Dominic Fischer
3bb49b049a
Deduplicate half duplex SPI setup (#2223)
* Deduplicate half duplex SPI setup

* clippy

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-25 10:03:20 +00:00
Dániel Buga
5076d1ee8f
DMA macro cleanup (#2226)
* Fix typo

* Deduplicate dma macro implementations

* Remove accidental defmt

* Extract count macro, use const block
2024-09-25 07:16:48 +00:00
Dániel Buga
fc924bf929
Remove TxPrivate and RxPrivate (#2225) 2024-09-25 06:27:43 +00:00
Dániel Buga
04f43d28c3
Prevent reentry on single-core, add basic tests (#2209) 2024-09-24 20:17:27 +00:00
liebman
cf9050d5d7
Support PSRAM in DmaTxBuf (#2161)
* support psram in DmaTxBuf

* add example that sometimes works :-(

* fmt

* cleanups

* allow chunk_size upto (including) 4095

* this test is passing for me now

* remove chunk_size and compute based on block_size

* return error in `prepare_transfer` if psram is found on non-esp32s3
add `dma_tx_buffer` macro

* missing parens

* changelog

* default 4092 for esp32 & fmt

* no errors anymode

* use block_size is_some to flag invalid psram in prepare_transfer

* drop block_size from macro, the buffer allocation was not being aligned - its not needed for dram anyway.

* missed macro example

* use defmt::Format that decodes owner like Debug

* fix typo

* DmaTxBuf: its an error if buffer is in psram and block_size is none

* DmaTxBuf: its an error if buffer is in psram and block_size is none

* update for PSRAM feature changes

* address alignment comments
add simple test

* fmt

* better alignment test

* revert alignment test

---------

Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
2024-09-24 15:21:58 +00:00
Dominic Fischer
826754c482
Remove ChannelTypes trait (#2220)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-24 15:01:11 +00:00
Jesse Braham
4534ee13ae
Implement embedded_hal_async::delay::DelayNs for TIMGx timers (#2084)
* Update `hil-test` package dependencies, add simple test for async delay with `SYSTIMER`

* Implement `embedded_hal_async::delay::DelayNs` for the `TIMGx` timers

* Improve tests slightly

* Update `CHANGELOG.md`

* Enable `delay` and `delay_async` tests for the ESP32-H2

* Fix error in `delay_async` test after rebasing

* ESP32 does not have `SYSTIMER`, so don't try to test it :)

* Protect int_ena modifications with INT_ENA_LOCK, clear int_clr in ISRs, move interrupt binds from Future constructor into new_async constructor

* Fix wrong imports

* Address reviews: Remove duplicated/useless code and add HIL test for delay_us and delay_ms

* Implement DelayNs on Target instead of Periodic

* clean dead code

* fix after rebase

* fix build errors

* More accurate nanos to ticks calculation

* Fix wrong handler passed to set_interrupt_handler()

* Update esp-hal/src/timer/timg.rs

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

* cleanup left over

---------

Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Dániel Buga <bugadani@gmail.com>
2024-09-24 08:50:06 +00:00
Scott Mabin
117327e206
esp-config: allow negative values (#2204)
* esp-config: allow negative values

* Add small test for parsing erroneous negative values

* split Value::Number into signed and unsigned
2024-09-24 07:07:06 +00:00
Dominic Fischer
26fc8871db
Simplify DMA interrupt handlers (#2215)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-23 16:55:54 +00:00
Dániel Buga
02d221ee52
Fix TWAI on ESP32 (#2207)
* Some more gpio cleanup

* Allow TWAI loopback using the same pin, enable ESP32

* Impl Format for ErrorKind

* Generic frame constructors

* More TWAI cleanups

* Fix signals

* Set self-reception bit

* Teach users to use const blocks

* Fix resetting TWAI

* Set opmode when starting

* Apply errata workaround

* Fix ESP32 baudrate

* Clean up read_frame a bit

* Changelog

* Clean up clippy

* Fix compile errors

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-09-23 15:24:27 +00:00
Dániel Buga
f2c473d3bc
Remove DMA RegisterAccess::init_channel (#2205) 2024-09-23 14:48:20 +00:00
Dániel Buga
d971d65c98
Add chip-specific features for tests/examples (#2175)
* Refactor metadata parsing to allow spaces in keys

* Emit separate examples per chip

* Allow setting features for specific chips
2024-09-23 11:42:11 +00:00
liebman
987f00bb1d
PARL_IO: fix for garbage output at the start of some TX operations (#2211)
* per TRM the TX clock should only be re-enabled after tx_start

* CHANGELOG

* added tests to check the for the correct number of clocks during valid

* parl_io: fix test for esp32h2

* tests: parl_io: h2 PCNT does not like 20MHz
2024-09-23 10:27:43 +00:00
Dominic Fischer
794cdb0af4
Use enumset for DMA interrupts instead of countless functions (#2196)
* [1/x] Use enumset for DMA interrupts instead of countless functions

* [2/x] Remove the countless functions from RegisterAccess

* Use Into

* [3/3] Use enums everywhere in the DMA module

* Remove redundant enum_set!

* Remove `available_` prefix

* Use `pending_` prefix

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-23 08:43:56 +00:00
Dániel Buga
89d9de67eb
Enable QSPI tests on ESP32 and clean up (#2198)
* Clean up qspi test cfgs, enable on ESP32

* Correct comments

* Clean up init_spi_data_mode

* Fix qspi_write on ESP32

* Further cleanup in SPI driver

* Clean up qspi_read

* Fix qspi_write_read test on ESP32

* Merge QSPI tests

* Clean up test

* Attempt to fix test GPIO assingment

* Update esp-hal/src/spi/master.rs

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

* Update esp-hal/src/spi/master.rs

* Make sure pins have no internal pullups

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-09-23 08:37:35 +00:00
Dániel Buga
3ee8fa61ee
Apply rustfmt fix (#2210) 2024-09-23 08:19:29 +00:00
Björn Quentin
37fa662fe7
Remove most PSRAM features (#2178)
* Make most of PSRAM features into run-time configs

* Make CI green again

* Make CI green again

* Update esp-hal/MIGRATING-0.20.md

Co-authored-by: Scott Mabin <scott@mabez.dev>

* Use Range

* CI

* Rebase fixes

* Update esp-hal/src/lock.rs

Co-authored-by: Scott Mabin <scott@mabez.dev>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2024-09-20 16:43:25 +00:00
Dániel Buga
d4e463b3ff
Slight general cleanup, enable dma-macros test, allow using virtual mem2mem channel on c2 (#2200)
* Cfg features, not devices

* Remove InterruptBinder

* Clean up allow(declare_interior_mutable_const)

* Small embassy cleanup

* Enable dma-macros for 32 and S2

* Use MEM2MEM1 on C2

* Remove esp32-specific code from test
2024-09-20 15:04:18 +00:00
Sergio Gasquez Arcos
3d0a1998fa
Allow configuring the watchdogs in the init config (#2180)
* feat: Allow configuring the watchdogs in the init config

* docs: Update changelog

* refactor: Remove unnecesary unsafe

* feat: Add a config module

* test: Add some init tests

* style: Rename all ocurrences to esp_hal::config::Config::default()

* style: Fix format

* fix: Doc errors

* revert: Move Config struct to lib.rs

* tests: Add default config test

* test: Add a test with CpuClock::max()

* test: Add timg1 test

* feat: Move Config struct to config module and reexport it in lib.rs

* fix: Fix init compilation for C2

* revert: Move Config struct to config module and reexport it in lib.rs

* fix: Use proper timergroup
2024-09-20 13:51:35 +00:00
Björn Quentin
370f54119f
Create mutexes in heap memory (#2202)
* Create mutexes in heap memory

* CHANGELOG.md

* Remove unnecessary CS usage
2024-09-20 12:45:57 +00:00