41 Commits

Author SHA1 Message Date
Dániel Buga
3a5aa72c4e
Define analog/LP functions (#3781)
* Shorten name

* Define analog/rtc functions

* Try to make the data useable

* Remove general pin attributes

* Do not generate unnecessary expanded matchers

* Remove expanded GPIO cases

* Move simplified io_type to where it is used

* Fix RTC IO with resistors calls

* Hide macros on H2

* Define rtcio pins for C2/C3

* Fix S2

* Compare against the correct GPIO number

* Deduplicate

* Restore one waker per pin

* Remove case that is no longer needed, avoid inline(always)
2025-07-11 09:41:50 +00:00
Simon Neuenhausen
3d6e522cbc
Allow splitting control over modem clocks. (#3687)
* Minimal architecture for split RCC.

* Removed critical section.

* Add all modem clock controllers and adjust esp-ieee802154.

* Fixed incorrect cfg.

* Fixed unstable attribute usage.

* Replaced AtomicU8 with Cell<u8>

* Reverted example channel back to 15

* Added unstable attribute to ModemClockController impls.

* Remember to actually increase the ref count.

* Experimentally removed RadioClockController

* Merged ref counters and made decrease panic if zero is reached.

* Removed RADIO_CLK peripheral.

* Removed RADIO_CLK again.

* Revert "Removed RADIO_CLK again."

This reverts commit 6da2d2834850068aa21bc52b141de2cfd8154acc.

* Removed RADIO_CLK without reformatting the files.

* Applied changes to examples and hil-tests.

* Fixed OS adapter for C2 and H2

* Adjusted docs and used unwrap!

* Fixed comments.

* Added changelog.

* Fixed esp-wifi for esp32h2.

* Changed comment for PHY_CLOCK_REF_COUNTER.

* Fixed lint for esp32c2.

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

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

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

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

* Removed unnecessary comments and made init_radio_clocks unstable.

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

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

* Fixed lint.

* Removed clocks_ll functions for chips that don't have those peripherals.

* fmt

* Changed modem clock controller stealing.

* Added lifetime

* fixed peripheral stealing again

* Made modem_clock_controller not const.

* Used type alias instead of function for peripheral stealing.

* fmt

* Adjusted remaining comments.

* Added note about coex.

* fmt

* misc

* Revert "misc"

This reverts commit d8740421e0dff84af605160939e246f2308a48e1.

* Regenerated esp metadata

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-07-08 17:23:55 +00:00
Dániel Buga
1a9b4bafe0
Calculate max input/output signal ID automatically (#3773) 2025-07-08 13:39:00 +00:00
Dániel Buga
692a768b3a
Introduce esp-metadata-generated (#3754)
* Move macros to new crate

* Generate a single file

* Pre-generate esp-metadata-generated

* Move saving code to xtask

* Format with both rustfmt and prettyplease

* Fix doc build

* Unhide macros

* Fix doc string

* Update semver-check baseline
2025-07-07 15:37:05 +00:00
Dániel Buga
9146407573
Fix and extend pin layouts (#3726)
* Fix ESP32 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Tabulate ESP32

* Fix C2 pin layout

* Fix C3 pin layout

* Fix C6 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Note AF availability on IoMuxSignal

* Add mising AFs to H2

* Remove unavailable pins

* Add mising signals to S2

* Add mising signals to S3

* Changelog

* Update semver baseline

---------

Co-authored-by: rmsyn <github@weathered-steel.dev>
2025-07-02 13:16:48 +00:00
Dániel Buga
21f1d89f15
Generate peripherals macro call & remove paste (#3713)
* Expand peripheral metadata

* Generate peripherals macro call

* Remove paste from peripherals

* Add missing peris

* Fix ETM and TRACE0 naming

* Remove redundant tsens symbol

* Remove RTCIO stuff from h2

* Rename S2 RTC_CNTL

* Add missing SYSCON back to S2

* Do not mark the GPIO singleton stable

* Treat unlisted drivers as not available

* Assign stability based on driver info

* Fmt

* Remove unused info
2025-07-01 19:31:21 +00:00
Dániel Buga
8c4878cb03
Refactor AssistDebug symbols (#3730) 2025-07-01 14:42:27 +00:00
Dániel Buga
745cfd71b6
de-paste! the any_peripheral macro (#3699)
* Stop using paste in any_peripheral

* Drop unused macro

* Generate a delegate macro for any-peripheral dispatching

* Fix up PDMA
2025-07-01 13:48:40 +00:00
Dániel Buga
175f4a16b6
Extract SPI metadata (#3702)
* Extract SPI M/S metadata

* Clean up additional instance trait

* Further SPI cleanups, add OSPI pin setters

* Re-generate semver baseline

* Fix typo
2025-07-01 11:13:26 +00:00
Dániel Buga
b2a8d6bcee
Move UART instance info to esp-metadata (#3698)
* Move UART instance info to esp-metadata

* Fix typo
2025-06-30 16:38:15 +00:00
Dániel Buga
b11d810d97
Tweak and make use of the old bind_X_interrupt functions (#3689)
* Rename bind_interrupt functions

* Generate enable/disable functions, remove redundant irq mapping from metadata

* Clean up PARL_IO

* Refactor SPI master, I2S, Uart

* Update USB_DEVICE
2025-06-30 15:28:42 +00:00
Dániel Buga
9d452a108f
Move USB device pin info to metadata (#3685)
* Allow else in impl_for_pin_type

* Move USB pin workaround info to metadata

* Simplify pin attr collection
2025-06-27 15:13:24 +00:00
Dániel Buga
c72889a73d
Generate i2c instances from metadata (#3678) 2025-06-24 12:18:22 +00:00
Dániel Buga
fbe8ddc954
Move AnalogPin's impl out of the macro (#3668) 2025-06-24 10:51:27 +00:00
Dániel Buga
1cd3a28954
Move IO_MUX signals to metadata (#3663)
* Generate Input/OutputSignal enums

* Deduplicate alternate function tables

* Don't misuse instance config for pins and signals
2025-06-23 14:43:17 +00:00
Dániel Buga
9507fa38b4
Move smaller GPIO properties to metadata (#3657)
* Move other GPIO properties

* Redo USB pins as pin capability

* Deduplicate interrupt status enum

* Remove unnecessary interrupt enable bits on S2

* Update S2 PAC and remove manual io_mux hackery

* Generate io_mux function from metadata
2025-06-23 12:45:21 +00:00
Dániel Buga
b98631570f
Move GPIO pin properties to metadata (#3656)
* Reorganize esp-metadata

* Move GPIO properties to metadata

* Fix AF enum variants, remove need for paste for them
2025-06-20 07:45:49 +00:00
Dániel Buga
2438d03b21
Simplify generated code to save on build time, yeet a few dependencies (#3643)
* Reduce use of iter::chain

* Cache all symbols

* Trim xtensa-lx-rt deps

* Remove unused dep

* Replace chrono with jiff

* Yeet minijinja

* Save a bit on toml_edit

* Disable some default features

* Disable regex log filters

* Reduce xtensa-lx-rt build script

* Remove unnecessary dependencies

* Remove darling

* Update embedded-test

* lol

* Clean up

* Only validate loaded config once

* fmt

* Changelog
2025-06-17 20:35:00 +00:00
Dániel Buga
891a5a4a8c
Move some more peripherals to metadata (#3633)
* Remove gpio bank 1 symbol

* Remove intr status width symbols

* Allow virtual periphs, redo ADC/DAC
2025-06-17 08:10:12 +00:00
Dániel Buga
c29c436be5
Prefix peripheral cfg symbols with chip_has_* (#3628)
* Prefix peri cfg with `soc_has_`

* Clean up ETM
2025-06-16 08:13:28 +00:00
Dániel Buga
3e6b85bf30
Update i2c/spi instance info (#3627)
* Add instances to drivers

* Move AnyI2c

* Move AnySpi and DataMode

* Generate new semver baseline
2025-06-13 13:56:52 +00:00
Dániel Buga
793b01beaa
Move timer instance config into driver metadata (#3626)
* Remove timg_timer1 symbol

* Ensure instances exist

* Rename timers to timergroup

* Remove unnecessary cfg
2025-06-12 14:49:04 +00:00
Dániel Buga
db3eb3da95
Remove hand-defined radio symbols (#3632) 2025-06-12 13:04:36 +00:00
Dániel Buga
f22ddb4a87
More i2c metadata & some additional cleanup (#3620)
* Define more i2c metadata

* Remove I2C1 AHB base address

* Encode address in metadata

* Extract timeout value calculation
2025-06-11 09:47:42 +00:00
Dániel Buga
f394af8ca2
Peri support corrections (#3621) 2025-06-10 13:58:19 +00:00
Dániel Buga
48a5927767
Generate peripheral support table (#3617) 2025-06-10 13:13:24 +00:00
Dániel Buga
f6d54a0471
Generate macros from metadata (#3604)
* Generate macros from metadata

* Don't generate metadata env vars

* Add trm link, change cores to integer

* Port RMT memory constants

* Add some I2C flags

* Auto-generate PeriConfig, remove trait

* Make sure memory_range is hidden
2025-06-10 10:06:32 +00:00
Björn Quentin
faf7115b0c
Define DRAM memory region in esp-metadata (#3300)
* Define DRAM memory region in esp-metadata

* CHANGELOG.md

* Dedicated macros for memory region start/end

* Use `from_str_radix` in esp-config

* Fix search+replace mistake

* Fix

* fix'n fmt

* fix unused

* Minor change
2025-04-02 14:56:34 +00:00
Dániel Buga
17255ac0ab
Enable async ADC for C2 and H2 (#3082)
* Enable async ADC for H2

* Enable for C2

* Prevent disabling interrupt if an async ADC is in use

* Introduce adc1/2 symbols
2025-02-03 09:41:04 +00:00
Davo
5a64d9ba8f
feat: add support for internal temperature sensor (tsens) for esp32c6 and esp32c3 (#2875)
* feat: add basic support for temperature sensor (tsens) for esp32c6

* feat: add basic support for temperature sensor (tsens) for esp32c3

* feat: add configurable clock source for temperature sensor

* feat: add Temperature struct to avoid enforcing usage of floats

- Also add misc derives to multiple structs
- Add power_up / power_down methods to TemperatureSensor
- Enable ApbSarAdc via PeripheralGuard

* fix: move tsens module to unstable module list
2025-01-07 16:40:12 +00:00
Dániel Buga
6b01f7993b
SPI and related changes (#2681)
* Define Octal SpiDataMode

* Fix BitOrder capitalization

* Hide DmaError

* Derive more traits

* Return error for unsupported half-duplex parameter combinations

* Remove unnecessary implementation detail

* Return error instead of silently breaking transaction

* Downgrade assert to debug_assert

* Expand on the enum variants

* Remove redundant imports

* Hide some unstable functions
2024-12-06 10:30:43 +00:00
Dániel Buga
9458fd3ed4
[DMA 8/8] Burst configuration (#2543)
* Implement burst configuration

* Reject transfers if the DMA in incapable of accessing external memory

* Fix psram

* Rename, documentation

* Address a few review comments

* Check buffer length, too

* Return error instead of panic

* Allow users to only specify the relevant burst config

* Add missing conversion

* Add missing docs

* Fix IN alignment requirements

* Fix test

* Deduplicate chunk size literal
2024-12-06 08:30:58 +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
Björn Quentin
cfb83b153d
Fixed triggering a debug-assertion during scan (#2612)
* Fixed triggering a debug-assertion during scan

* CHANGELOGs

* Change `debug_assert` into warning level log

* Enable debug-asserts in hil-test, qa-test and examples

* Change the way we detect and warn about debug-builds

* Warn if opt-level is `0` or `1`
2024-11-27 14:14:04 +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
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
d5afeeddc8
H2: enable TWAI, enable delay test (#2199)
* Add TWAI support for H2

* Enable delay test on h2

* Also enable example

* Changelog

* De-CAN the example
2024-09-20 07:04:52 +00:00
Jonathan
94db708f49
Touch support for ESP32 (#1873)
* Added touch pad support

* touch: Introduced blocking mode

* touch: moved fns out of TouchPad to prepare async code

* touch: added async support and embassy example
2024-08-06 07:19:41 +00:00
Björn Quentin
4f9dc960c6
Improve xtensa interrupt latency (#1735)
* Avoid U128

* Avoid unnecessary calls

* CHANGELOG.md

* Simplify

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-07-03 15:43:01 +00:00
Jesse Braham
8aee84f842
[3/3] Timer abstraction: cleanup, simplification, and documentation (#1630)
* Add a new `timg_timer1` symbol to `esp-metadata` definitions

* Make `Timer::load_value` fallible (when the value is too large)

* Clean up, simplify, and document the `timer` module and its submodules

* Fix various issues

* Update the timeout value verification for `SYSTIMER`

* Clippy

* Introduce new `PERIOD_MASK` constant for validating timeout values
2024-05-28 14:12:06 +00:00
Jesse Braham
1f129744fd
Create the esp-metadata package, update esp-hal build script to use it (#1256) 2024-03-13 12:27:24 +00:00