69 Commits

Author SHA1 Message Date
Jesse Braham
a7673b35f7
Remove scan_*_max and scan_n* functions from esp-radio (#3963)
* Remove `scan_*_max` and `scan_n*` functions

* Derive `BuilderLite` for `ScanConfig`

* Update migration guide for `esp-radio`

* Update changelogs
2025-08-20 13:22:26 +00:00
Björn Quentin
1e611aaf80
More doc replace (#3788)
* Allow macros for `doc_replace`

* Use `doc_replace` for the DMA macros

* Cleanup
2025-07-11 12:04:56 +00:00
Dániel Buga
68b992f6d6
Add macro to let rustfmt format code blocks in doc comments (#3744)
* Add insert_doc_snippet proc macro

* Replace placeholders

* Allow defining (conditional) replacements

* Use unstable features for module-level docs

* Document the new macro

* Rename macro

* Lint

* Remove nonsense code block check, change syntax

* Remove redundant doc_switch macro
2025-07-04 08:25:37 +00:00
Dániel Buga
517b5ccbe2
Make cargo xfmt respect the format config (#3739)
* Make cargo xfmt respect the format config

* Make sure comments and doc code have the same width
2025-07-03 08:18:02 +00:00
Dániel Buga
d91806197d
Don't check default priority (#3693) 2025-06-25 14:20:14 +00:00
Juraj Sadel
228d1384c1
fix nightly ci (#3662) 2025-06-19 08:43:50 +00:00
Dániel Buga
75ac7ead62
Delete esp-build (#3645)
* Delete esp-build

* Delete redundant clone
2025-06-18 09:33:16 +00:00
Dániel Buga
772a64a90a
Allow renaming esp-hal (#3653) 2025-06-18 09:29:03 +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
f71127446b
Remove proc-macros-error2 (#3646) 2025-06-16 15:00:17 +00:00
Dániel Buga
0579805d12
Add #[enable_doc_switch] (#3630) 2025-06-16 12:00:16 +00:00
Sergio Gasquez Arcos
ab18d89470
fix: Nightly issues (#3434) 2025-04-28 11:41:35 +01: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
Scott Mabin
0876bac6c5
xtask: refactor feature selection and package validation (#3358)
* apply_feature_rules applies more things

* apply features in one place only, fix missing features and clippy warnings

* move various logic to package enum, re-add the ability to test packages with custom feature sets

* small cleanup

* simplify msrv check, fix CI

* review feedback

* try and fix msrv check

* rebase fixups

* use msrv toolchain in check
2025-04-14 11:23:54 +00:00
Björn Quentin
873f033089
Disallow Priority::None for the #[handler] macro (#3304)
* Disallow `Priority::None` for the `#[handler]` macro

* CHANGELOG
2025-03-27 11:46:14 +00:00
Björn Quentin
154f3204d4
Mark unstable parts of config unstable (#3215)
* Mark unstable parts of config unstable

* Unstable
2025-03-05 14:41:12 +00:00
Dániel Buga
af6ee36d93
Ability to precompute/cache config register values (#3011)
* Cache bus clock register and support clock source

* Recalculate eagerly to keep Config Copy

* Destabilize UART clock source

* Update I2C

* Changelog

* Refactor builder lite helpers for more flexibility

* Flatten config structs

* Add getters, hide fields

* Hide all config fields

* Fix changelog

* Document the precomputation
2025-01-30 09:44:52 +00:00
Björn Quentin
732c442c24
Main macro (#2941)
* Re-organize code

* Update dependencies

* Introduce `esp_hal::main` macro

* Migration Guide

* CHANGELOG.md

* Move around

* Remove redundant features, improve error message

---------

Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
2025-01-13 17:08:47 +00:00
Jesse Braham
036d08e09f
Annotate builder functions with #[must_use] (#2841) 2024-12-19 10:10:23 +00:00
Jesse Braham
1a2bee6f1f
Add derive macro for BuilderLite, add #[non_exhaustive] to some enums and structs (#2614)
* Add a derive procmacro to implement the Builder Lite pattern for a struct

* Add `#[non_exhaustive]` and derive `BuilderLite` where necessary in I2C module

* Add `#[non_exhaustive]` and derive `BuilderLite` where necessary in UART module

* Add `#[non_exhaustive]` and derive `BuilderLite` where necessary in SPI module

* Update `CHANGELOG.md`

* Fix build errors in HIL tests

* Fix generated doc comments

* Return a `ParseError` rather than panicking

* Add a method to set the value to `None` for `Option` types
2024-11-27 15:54:43 +00:00
Dániel Buga
aed0fac0eb
Rewrite time driver (#2559)
* Rewrite time driver

* Don't store priority

* Changelog

* Fix doc example

* Use separate locks for Alarms

* Mention generic queues

* Cache the next wakeup timestamp

* Immediately repoll if timestamp is in the past

* Add benchmark

* Remove equality check for now

* Enable interrupts when allocating the alarm

* Clean up

* Use relaxed ordering

* wut

* Typo

* Move benchmar

* fmt
2024-11-25 17:02:47 +00:00
Jesse Braham
b06c7a470c
Remove unnecessary features from esp-hal-procmacros, enable rtc-slow feature for Xtensa devices (#2594)
* Remove unnecessary features from `esp-hal-procmacros`

* Enable the `esp-hal-procmacros/rtc-slow` feature for Xtensa devices

* Update CHANGELOGs
2024-11-25 15:18:14 +00:00
Jesse Braham
92b91257e9
Remove get_ prefix from functions (#2528)
* Remove `get_` prefixes from functions

* Update migration guides for `esp-hal` and `esp-wifi`

* Update `CHANGELOG.md` files
2024-11-13 15:40:26 +00:00
Gnome!
4d9ea52eae
[esp-hal-procmacros] Update to proc-macro-error2 (#2090) 2024-09-05 11:40:52 +00:00
Dániel Buga
39109a4a05
Remove gpio dispatch macro-defining proc macro (#2069)
* Keep a single PinType trait

* Merge impl blocks

* Deduplicate usb pad workaround

* Deduplicate some bit manipulation

* Remove gpio dispatch proc macro

* Inline PinType into GpioProperties
2024-09-04 14:47:24 +00:00
Dániel Buga
8e6411bd31
Random cleanups in non-checked packages (#2034)
* Deduplicate feature check macros

* Re-enable rust-analyzer for most of the workspace

* Cargo fix

* Turn off defmt

* Only build xtask

* Clippy pls

* Fix CI

* Fix paths

* Always create doc directory first

* Revert r-a

* Update esp-hal-procmacros/src/lp_core.rs

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

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-08-30 14:45:54 +00:00
Jesse Braham
776f34cff1
Re-export the esp_hal_procmacros::main macro from esp-hal-embassy instead of esp-hal (#1828)
* Re-export the `main` procmacro from `esp-hal-embassy` rather than `esp-hal`

* Fix documentation warnings

* Flatten the `time_driver` module

* clippy

* Update `CHANGELOG.md`
2024-07-18 09:31:03 +00:00
W Etheredge
a2883ac318
Take 2 on #[ram] soundness (#1677)
* Improve `#[ram]` soundness

* Allow `Atomic*` in `#[ram(persistent)]`

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2024-07-10 13:30:48 +00:00
Jesse Braham
2bef914e7c
Update and improve esp-lp-hal (#1754)
* Fix warning in `esp-hal-procmacros` when building for `esp-lp-hal`

* Document cargo features, use `embedded-hal@1.x.x` by default

* Derive more traits on public types, assorted cleanup and improvements

* Implement `embedded-hal-nb` and `embedded-io` traits for UART

* Update `CHANGELOG.md`

* Silence `clippy` for now...

* Module documentation for UART

* Update module documentation format
2024-07-09 17:06:54 +00:00
Juraj Sadel
4c5e493b1b
esp-hal: Add runnable doctests to peripheral drivers (#1663)
* Check docs examples II

* rebase and update

* fix root crate macro expansion in doctest snippets

* clean up and fmt

* add xtask run-doc-test subcommand and check in CI

* address review comments

* remove commented printlns

* fix the host target check

* rebase and update

* hide docs for before_snippet macro and remove commented block code in twai
2024-06-11 10:18:09 +00:00
Jesse Braham
48e3e912f3
Extract embassy support into esp-hal-embassy package (#1595)
* Extract embassy support into `esp-hal-embassy` package

* Update relevant packages/examples/tests to get CI green again

* Add back `defmt` support

* Re-export `Executor` and `InterruptExecutor` rather than making `executor` module public

* Document the `esp-hal-embassy` package

* Update `CHANGELOG.md`

* Hack together a "fix" for the `SYSTIMER` time driver

* Make `clippy` shut up
2024-06-03 11:27:20 +00:00
Björn Quentin
2faa2654cb
GPIO Refactoring (#1542)
* GPIO Refactoring

* CHANGELOG.md

* Addressed review comments

* Use `Level` instead of plain bool in public API

* Let drivers enable analog functions
2024-05-15 08:49:33 +00:00
Dominic Fischer
866933bf6f
Fix entry macro for ULP hal (#1488) 2024-04-22 14:42:10 +00:00
Jesse Braham
586744070b
Remove some #[allow] attributes and an unused function (#1440)
* Remove TODO comments from linker scripts for ESP32-C6/H2

* Small refactor in Xtensa interrupt module to get rid of some allow attributes

* Remove unused function and attribute from `esp-hal-procmacros`
2024-04-16 10:45:57 +00:00
Jesse Braham
f6925480f2
Remove unused function from esp-hal-procmacros (#1421) 2024-04-11 09:29:29 +00:00
Björn Quentin
1fdfc9270e
Remove the #[interrupt] macro (#1409) 2024-04-09 10:11:57 +00:00
Jesse Braham
fd9f7895f6
Extract inner modules of gpio module into their own files (#1397)
* Extract inner modules of `gpio` module into their own files

* Update `CHANGELOG.md`

* Add missing doc comment in `gpio::lp_io` module

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2024-04-05 12:33:49 +00:00
Björn Quentin
4077734c3c
Runtime DMA interrupt binding (#1300) 2024-03-26 13:56:48 +00:00
Björn Quentin
fd4f5592a4
RMT: allow driver to init as blocking or async (#1341)
* RMT: allow driver to init as blocking or async

* CHANGELOG and minor fixes
2024-03-25 13:54:03 +00:00
Anthony Grondin
1b2dab1dff
Add missing #[doc(hidden)] attributes for embassy proc macros (#1302)
Fixes https://github.com/esp-rs/esp-hal/issues/1233
2024-03-21 22:10:15 +00:00
Scott Mabin
93d31e76d8
Add InterruptHandler wrapper (#1299)
* Add InterruptHandler

* Which takes the handler and a prio.
* Updates the `#[handler]` macro to create this for us.

* changelog
2024-03-21 15:45:35 +00:00
Björn Quentin
2b4c408333
Runtime interrupt binding (#1231)
* Interrupt runtime binding

* Add `set_interrupt_handler` for GPIO

* Fix

* Fix typo

* Make sure to produce a warning for an unused `#[handler]`

* Simplify GPIO interrupt handling

* Appease Clippy

* Make sure to patch the PACS in esp-hal

* Use latest PAC commit

* CHANGELOG.md entry
2024-03-13 15:45:34 +00:00
Jesse Braham
3b6a3cf3a4
Fix some clippy/build warnings, clean up root Cargo manifest (#1230)
* Remove old package names from workspace exclude list

* Fix warning in `esp-hal-procmacros`

* Resolve clippy warnings
2024-03-01 05:56:02 -08:00
Jesse Braham
6a663f8b1a
Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196)
* Remove the chip-specific HAL packages

* Update some doc comments which were missed, fix build script for ESP32/S2

* Refactor/update `esp-hal-procmacros`

* Create the `examples` package, add back all of the previously existing examples

* Use `xtask` automation package for checking examples and documentation in CI

* Combine the `rt-riscv` and `rt-xtensa` features into a single `rt` feature

* Bump MSRV to 1.76.0 (shocking!)

* Re-document the features for the HAL

* No need to re-export the `riscv` package like this

* Make clippy happy, improve CI clippy checks

* Update `CHANGELOG.md`

* riscv: zero bss

Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com>

* Address a number of review comments

* Correct pin number in `hello_rgb` example for ESP32-C3

* Address the remaining review comments

* More small tweaks/improvements

* Fix RMT examples (#11)

* Fix RMT examples

* Remove logger-init

* Make I2S examples work on ESP32 (#12)

* Make I2S examples work on ESP32

* Remove logger init

* Fix the direct-vectoring examples on all RISCV chips (#10)

* Update GPIOs for some examples...

* Embassy timer example fixes (#13)

* Switch to generic queue instead of integrated for all examples

* changelog

* Update GPIO in another example, make `rustfmt` happy

* Fix ESP32-S2 PSRAM

* Avoid UART0 and SPI flash pins (#15)

* Avoid UART0 and SPI flash pins

* Fix spi_eh1_device_loopback for non-ESP32

* Update examples/src/bin/gpio_interrupt.rs

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>

---------

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com>
Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
2024-02-27 14:10:11 +00:00
Juraj Sadel
9378639e4c
C6: LP_I2C basic driver (#1185)
* After more analysis and coding

* More work is done, writing/reading WIP

* `write` prototype done, small fixes. Read next

* pre-rebase

* Rebased and updated

* Pre-final state of driver

* More work (near-final state) done

* WIP

* WIP

* working

* cleanup

* changelog

* address review comments

* remove Option from conjure and improve lp-i2c example description

---------

Co-authored-by: Kirill Mikhailov <konnor1980@yandex.ru>
2024-02-21 14:18:54 +00:00
Jesse Braham
ac07f3c460
Document the features of the remaining packages (#1143)
* Document features for `esp-riscv-rt` package

* Document features for `esp-hal-smartled`

* Document features for `esp-hal-procmacros`
2024-02-06 07:12:05 -08:00
Jesse Braham
9bf70ff792
Combine the esp-ulp-riscv-hal and esp32c6-lp-hal packages (#1115)
* Combine `esp-ulp-riscv-hal` and `esp32c6-lp-hal` into a single package

* Update LP core examples

* Update CI workflow

* Fix `LP_UART` example
2024-01-26 13:46:51 +00:00
Juraj Sadel
bc96351c17
C6: Basic LP_UART driver (#1113)
* WIP

* Add basic LP_UART C6 driver

* Add lp-uart example for C6

* modify entry macro and fmt

* final cleanups

* revert lp_core_basic example and add lp_core_uart and uart examples

* changelog

* review changes

* second changelog

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2024-01-25 16:22:14 +00:00
Jesse Braham
e5cd1bd33e
Add initial support for the ESP32-P4 (#1101)
* Add `esp32p4` feature to `esp-hal-procmacros`

* Add `esp32p4` feature to `esp-hal-common`

* Create the `esp32p4-hal` package

* Add ESP32-P4 to CI workflow

* Fix a silly typo :)

* Update `CHANGELOG.md`
2024-01-22 15:28:05 +00:00
Dániel Buga
39519dfdc9
RISC-V executors (#947)
* RISC-V executors

* Add multiprio example to RISC-V SoCs

* Check new examples

* Hack in support for generic queue

* Reserve SoftwareInterrupt0 for multicore thread-mode executors

* Merge interrupt executors

* Merge thread-mode executors

* Document the new features and expand on time drivers

* Main tasks don't have to return !

* Unify multiprio examples

* Undo C6 log output change
2023-11-22 14:36:53 +00:00