339 Commits

Author SHA1 Message Date
Juraj Sadel
8a7f8361a6
UART: Move RX/TX pin assignment from constructor to builder functions (#2904)
* Add with_rx() and with_tx() methods to UART drivers

* changelog

* migration guide

* forgotten tests

* fmt

* fix H2 example

* Use the same calling order of calling TX and RX as before
2025-01-08 16:35:22 +00:00
Jesse Braham
bb406cec6b
Fix naming violations for spi::Mode enum variants (#2902)
* Fix naming violations for `spi::Mode`

* Update migration guide

* Update `CHANGELOG.md`
2025-01-07 15:55:19 +00:00
Dániel Buga
337b3cc6b7
Use _CONFIG_ to separate config prefix and key (#2848)
* Use two underscores to separate prefix

* Change separator to _CONFIG_

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-01-03 14:36:30 +00:00
Dániel Buga
1f929af377
Remove redundant config setters (#2847)
Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2025-01-02 09:55:37 +00:00
Anthony Grondin
0f384992cf
Update smoltcp to 0.12.0 and embassy-net to 0.5.0 (#2849)
* chore: Update smoltcp to `0.12.0` and embassy-net to `0.5.0`

* Add CHANGELOG entry

* Remove `wifi_dhcp_smoltcp_nal.rs` example

`smoltcp-nal`, a core dependency on which this example depends on doesn't receive the desired amount of maintainability needed to keep up to date with new dependencies releases.
2025-01-02 09:41:31 +00:00
Kirill Mikhailov
62c72947dd
Multiple API fixes in UART driver (#2851)
* Close a number of issues

doctest update

fmt

* changelog entry

* dumb

* addressing reviews

* Add an entry to migration guide
2024-12-20 14:01:11 +00:00
Dániel Buga
7f8af8a651
Remove prelude (#2845)
* Remove prelude

* Changelog
2024-12-20 10:24:57 +00:00
Sergio Gasquez Arcos
d4386adfc7
Rename Spi enums (#2828)
* feat: Rename Spi enums

* docs: Update changelog

* feat: Rename crate::Mode to crate::DriverMode

* docs: Udpate changelog

* feat: Rename DM type parameter to Dm for ECC

* style: rustfmt

* feat: Rename crate::Mode to crate::DriverMode
2024-12-19 08:41:59 +00:00
Jesse Braham
f6126502ae
Actually use a random seed in Wi-Fi examples (#2718) 2024-12-10 11:02:05 +00:00
Dániel Buga
5135965116
Hide most of the unstable peripherals (#2667)
* Hide most of the unstable peripherals

* Lint with correct toolchain, lint with unstable enabled

* Require unstable feature and lint using it

* Auto-lint xtensas with esp toolchain

* Fix msrv and ieee802154

* Add feature to examples

* Don't require building ieee802154 for all examples

* Mark modules in documentation
2024-12-06 11:03:56 +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
Tommaso Clini
dfa96820f0
DHCP support added to wifi embassy access point example (#2683)
* added dhcp to access point example, also GW IP is configure from environment as shown in Cargo.toml

* changelog entry

* Revert "changelog entry"

This reverts commit 3412d1c1948e42789f0dc2ec2d46ac3c23c879ac.

* default gateway IP in case env IP isn't provided

* dhcp server runs in a loop so that it will restart on an error
2024-12-05 11:22:36 +00:00
Dániel Buga
91d7f23982
Mark some dependencies as unstable (#2668)
* Mark some dependencies as unstable

* Fix docs

* Pass unstable to doctests

* Document the unstable feature
2024-12-04 09:58:41 +00:00
Dominic Fischer
94e7ffbcef
Remove Dma[Rx|Tx]Buffer::length (#2587)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-12-03 08:27:13 +00:00
Jesse Braham
891a12e13f
Derive Builder Lite pattern for HAL configuration, update examples/tests (#2645)
* Derive Builder Lite pattern for `esp_hal::Config` and `WatchdogConfig`

* User builder pattern for `esp_hal::Config` in examples/tests

* Update `CHANGELOG.md`
2024-12-02 14:45:05 +00:00
Björn Quentin
b6117d5040
Use opt-level to detect debug profile (#2622) 2024-11-28 10:52:11 +00:00
Dániel Buga
92910bf1cb
Constructor consistency update (#2610)
* UART: only implement constructors with config, define ConfigError

* UART: only implement interrupt functions for Blocking

* I2C: fallible constructors

* Lcd/Cam

* SPI

* Update tests and examples

* Changelog

* Add note about ConfigError

* Fmt
2024-11-28 09:28:50 +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
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
Scott Mabin
2512658653
[3/3] Timer refactor: Timer driver mode, ETM support and erasure (#2586)
* Add mode param and type erasure to high level timer drivers

* Add async impls for the timers plus eha impl

* re add etm example, fix etm for systimer

* re add tests

* Add Into<AnyTimer> + 'static bounds to the Timer trait

* remove set_alarm_active impl detail from the timer trait

* clippy

* doc fix ups

* changelog and migration guide

* review

* fix h2, reuse schedule for delay
2024-11-27 14:10:56 +00:00
Dániel Buga
eec75c8f82
Replace some esp-wifi critical sections with locks (#2554)
* Replace some esp-wifi critical sections with locks

* Remove critical section from event handlers

* Fix doc warnings and accidentally hard-coded esp32s3

* Use Lock in wifi_int_disable/restore

* Replace critical_section in ConcurrentQueue

* Deduplicate wifi_int_disable
2024-11-25 17:06:05 +00:00
Dániel Buga
ef98e2b24f
[DMA 7/8]: Remove Dma, move channels to Peripherals (#2545)
* Move DMA channels into Peripherals

* Initialize DMA in the critical section needed for clock management

* Update esp-hal/MIGRATING-0.22.md

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

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-11-25 09:31:18 +00:00
Kirill Mikhailov
8b36a43c07
Remove more examples. Update doctests. (#2547)
* WIP

* WIP(1)

* done

* changelog entry

* swint example needs to lose some weight

+ fix psram

* get twai and touch examples back, lcd example to qa, less embassy

* more moving

* move changelog entry

* address reviews

upd: revert "is_not_release" check

* rebase + a bit more changes

remove useless feature

* address review

remove inappropriate doctest tutorial

* get all sleep examples back and to qa-test

fmt

* get rid of some redundant printlns in doctests

* etm timer upd

* make printlns great again

* writeln! -> println!

* clear "timer with interrupts" doctest
2024-11-25 08:13:35 +00:00
Dániel Buga
fe482bdd05
Auto-initialize PSRAM (#2546) 2024-11-23 14:10:44 +00:00
Scott Mabin
79ca9d07aa
[2/3] Timer refactor: TIMG (#2581)
* system timer simplfication

* Removes _all_ type params on Alarm
* Systimer no longer implements peripheral ref, the peripheral ref
  pattern is instead intended to be used on the higher level timer
  drivers
* Removed `Unit` as a type, in favour of an enum
* Alarms are back in the main `SystemTimer` "driver"
* Made all `Unit` modification methods unsafe, it's not possible to
  modify the `Unit`'s safely whilst timers and or the `time::now` API is
  in use

* fix examples and tests (by removing them :D)

* changelog and migration

* Review feedback

* changelog and migration

* /unit_count/unit_value/g

* changelog and migration

* /unit_count/unit_value/g

* system timer simplfication

* Removes _all_ type params on Alarm
* Systimer no longer implements peripheral ref, the peripheral ref
  pattern is instead intended to be used on the higher level timer
  drivers
* Removed `Unit` as a type, in favour of an enum
* Alarms are back in the main `SystemTimer` "driver"
* Made all `Unit` modification methods unsafe, it's not possible to
  modify the `Unit`'s safely whilst timers and or the `time::now` API is
  in use

* Make TimerGroup Timer's dumb and untyped

* changelog

* review

* review
2024-11-22 16:14:14 +00:00
Scott Mabin
60a2c76005
[1/4] Timer refactor: system timer (#2576)
* system timer simplfication

* Removes _all_ type params on Alarm
* Systimer no longer implements peripheral ref, the peripheral ref
  pattern is instead intended to be used on the higher level timer
  drivers
* Removed `Unit` as a type, in favour of an enum
* Alarms are back in the main `SystemTimer` "driver"
* Made all `Unit` modification methods unsafe, it's not possible to
  modify the `Unit`'s safely whilst timers and or the `time::now` API is
  in use

* fix examples and tests (by removing them :D)

* changelog and migration

* /unit_count/unit_value/g

* etm doctest

* Review feedback
2024-11-22 11:24:06 +00:00
Dániel Buga
3a4a7632b1
[DMA 4/8]: Apply Peripheral pattern (#2526)
* Create DMA Channels inside peripherals

* Add PARL_IO into_async functions

* Update tests and examples

* Restore configurable priority via DmaChannel

* Add mode param to DPI driver

* Fix test by raising SPI frequency

* Fix split

* Changelog

* Update esp-hal/CHANGELOG.md

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

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-11-22 09:05:22 +00:00
Dániel Buga
973671c3cb
[DMA 3/8] Remove ChannelCreator types, temporarily disable burst mode (#2403)
* Remove ChannelCreator types and burst mode

* Fix up I2sParallel

* Always enable burst transfering descriptors

* Configure burst transfer with a non-bool for future chip support

* Reuse buffer preparation code

* Update LoopBuf as well

* Update lcd_cam tests

* Rename config, fix changelog
2024-11-21 15:01:29 +00:00
Björn Quentin
f9203dc523
Disable peripherals when unused (#2544)
* Disable peripherals when unused

* Fixes

* CHANGELOG.md

* Fix

* Address review comments

* Have dedicated guards for CAM and LCD

* Re-use `Cam`'s guard

* De-duplicate, assert

* fmt

* Require CriticalSection

* Address comments

* Remove redundant guard

* Use `GenericPeripheralGuard`

* Renaming
2024-11-21 09:21:28 +00:00
Dominic Fischer
7821968df8
Introduce RGB/DPI driver (#2415)
* Introduce RGB/DPI driver

* Choose different pin for HIL test

* fail

* Use official devkit

* merge update

* non_exhaustive

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-11-19 10:15:09 +00:00
Jesse Braham
2472e36232
Add the qa-test package (#2558)
* Teach `xtask` about the `qa-test` package

* Create the `qa-test` package and move some examples to it

* Check `qa-test` package in CI

* Add `README.md`
2024-11-18 11:00:17 +00:00
Jesse Braham
64f4fea403
Remove some examples which are adequately covered by documentation (#2538) 2024-11-14 09:32:18 +00:00
Jesse Braham
c19c7fcf01
Remove get_core() in favour of Cpu::current() (#2533)
* Remove `esp_hal::core()` in favour of `Cpu::current()`

* Update migration guide

* Update `CHANGELOG.md`
2024-11-13 16:13:47 +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
Dániel Buga
b11fc0fce8
Remove NoClkPin (#2531) 2024-11-13 15:07:55 +00:00
Björn Quentin
7da4444a7e
Fail RMT one-shot transactions if end-marker is missing (#2463)
* Fail RMT one-shot transactions if end-marker is missing

* CHANGELOG.md

* Add test

* Fix

* Fix

* RMT: use u32, turn PulseCode into a convenience trait

* Clippy

* Adapt test
2024-11-13 11:29:36 +00:00
Easyoakland
30276e1609
implement wifi event handling with data (#2453)
* implement event handling for apsta{,dis}connect and probe

add to wifi_access_point example

* hide internal `Option` to simplify api

* move handler call logic to event.rs

* update_handler_leak

* - Add comments

- match simpler api from `std::panic::update_hook`

- do not assume size_of in prelude

- make all events handleable

- box static instead of leak

* update changelog

* elide lifetime on default handler

* newtypes for all event types.

* add doc to newtypes

* fix previous doc example

* - `get_handler` -> `handler`
- pass critical section to event handlers
- comment on perf of Box<ZST>
- don't pass `prev` in `update_handler`, instead call previous handler first unconditionally

* pass cs to dispatch_event_handler

* don't print "unhandled event" for handled events.
2024-11-13 08:49:41 +00:00
Björn Quentin
5d120f7a70
Remove the integrated blocking networking stack (#2488)
* Add simple example using `smoltcp-nal`

* Remove the blocking networking stack

* Renaming

* Fix CI

* CHANGELOG.md

* Fixes after re-base

* Update esp-wifi/MIGRATING-0.10.md

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

* Improve diff in migration guide

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-11-12 11:43:01 +00:00
Dániel Buga
fbc57542a8
Remove pins from Io (#2508)
* Split pins off of Io

* Remove the GPIO peripheral

* p.GPIO
2024-11-12 10:36:25 +00:00
Dániel Buga
2c14e595db
I2C: add apply_config, implement SetConfig, add with_sda and with_scl (#2477)
* Implement apply_config, SetConfig

* Remove pins from constructors

* Implement timeout changes, document them

* Fix up changelog
2024-11-08 22:51:42 +00:00
Sergio Gasquez Arcos
7402ad61ed
Expose CSI API in esp-wifi (#2422)
* feat: (WIP) add CSI api

* feat: Enable G_CONFIG.csi_enable and update example

* fix: Allow user to set the dessired cb method

* fix: Clippy warnings

* fix: Add missing doccomments

* feat: Add csi_enable config

* refactor: Update CsiConfiguration c6 struct

* feat: Create set_csi WifiController and EspNowManager methods

* docs: Update changelog

* refactor: Rename CsiConfig struct

* docs: Document c6 version of CsiConfig

* feat: impl From<CsiConfig> for crate::include::wifi_csi_config_t

* style: Rustfmt

* docs: Fix comment

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

* docs: Fix typo

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

* feat: Enable CSI on examples by default

* feat: Handle errors

* style: Rustfmt

* feat: Update error

* feat: Panic if csi config is not enabled

* feat: Cfg CSI stuff when CSI is disabled instead of panicing

* fix: Clippy lints

* feat: Fix signed bitfields

* feat: Pass the cb via ctx

* feat: Update CSI callback to use closures

* refactor: Rename promiscuous_csi_rx_cb to csi_rx_cb

* feat: Move extra boxing inside set_receive_cb

* feat: Refactor CSI callback to use generic types

* refactor: Remove Sized bound from CsiCallback trait

* feat: Add csi_enable field to EspWifiConfig and update CsiCallback trait for conditional compilation

* feat: Remove unnecessary boxes

* feat: Update callback type in set_csi to require Send trait

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

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-11-08 16:33:13 +00:00
Scott Mabin
50d8187e39
esp-wifi: Remove unneeded features (#2446)
* remove async features

* phy-usb config

* modem powersaving

* Fix examples

* make ps a runtime config

* fix linting

* changelog and migration guide

* revert esp-config changes

* remove blanklines after doc comments

* cfg away ps API
2024-11-08 13:30:33 +00:00
Dániel Buga
6d6f6a7baa
Move I2C driver to i2c::master (#2476)
* Move I2C driver to i2c::master

* Update esp-hal/CHANGELOG.md

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

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-11-08 12:28:53 +00:00
Dániel Buga
d5e6ba5ceb
SPI slave with_pin functions (#2485) 2024-11-08 07:29:37 +00:00
Dániel Buga
0da6eec089
Move I2S drivers to i2s::master and i2s::parallel (#2472)
* Move I2S drivers to i2s::master and i2s::parallel

* Remove mention of master mode
2024-11-07 09:39:08 +00:00
Dániel Buga
8860aba9b2
Spi master: remove public hidden APIs, add Config/apply_config (#2448)
* Remove hidden public SPI API

* Fix in_progress flags not being set

* Remove redundant checks, fix full-duplex flag

* Remove now-redundant Send impl

* apply_config

* SetConfig

* Return ConfigError

* Unwrap config result in ctor
2024-11-06 09:03:43 +00:00
Dániel Buga
eabb6fb1c6
ETM improvements (#2427)
* ETM simplifications

* Work with GPIO signals

* Fix changelog
2024-11-05 13:39:19 +00:00
Dániel Buga
665fb0e278
Flatten Uart module, remove unnecessary data, replace methods with apply_config (#2449)
* Flatten uart config

* Do not remember at_command config

* Don't save config values in memory

* Move config implementations to Info

* Changelog

* Remove unused methods

* apply_config, SetConfig

* Fix test

* simplify futures

* Update esp-hal/CHANGELOG.md

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>

---------

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
2024-11-05 09:56:14 +00:00
Dániel Buga
0c86740418
Peripheral interconnect redo, vol 2 (split()) (#2418)
* Replace peripheral connection conversions with split

* Constrain Flex conversions
2024-11-04 11:29:28 +00:00