296 Commits

Author SHA1 Message Date
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
Dániel Buga
40c0a6944e
into_async (#2430)
* Remove configure_for_async

* Add into_async and into_blocking to I2c

* Add into_async and into_blocking to UsbSerialJtag

* Rework LCD_CAM

* Rmt

* RSA

* TWAI

* Uart

* Documentation

* Disable interrupts set on other core

* Move configure into RegisterAccess

* Disable interrupts on the other core

* Use EnumSet in RMT
2024-11-04 09:32:12 +00:00
Scott Mabin
c717f04d4d
Remove EspWifiInitFor & more granular init/deinit per driver (#2301)
* More granular init and deinit per driver

- Rework EspWifiInit
- No longer require EspWifiInitFor
- Add Drop impls for each driver, and add Drop for EspWifiController to
  fully deinit the stack

* unwrap! more stuff

* fixup examples and esp-now

* unwrap less stuff

* review feedback

* seal wifi traits, allow rng or trng to init esp-wifi

* changelog and migration guide

* return wifi error in esp now constructor instead of panic
2024-11-04 08:08:19 +00:00
Jesse Braham
fc4eaa1ebf
Make our nightly CI checks pass (#2356)
* Fix nightly lint errors for ESP32-C2

* Fix nightly lint errors for ESP32-C3

* Fix nightly lint errors for ESP32-C6

* Fix remaining nightly lint errors
2024-11-01 10:31:56 +00:00
Björn Quentin
e5b923b678
Esp wifi/more dynamic allocations (#2396)
* Dynamic allocation of timers

* Replace statically allocated NPL events

* Remove NPL CALLOUTS

* Remove NPL EventQueue

* Use `Vec` instead of `heapless::spsc::Queue` internally in NPL

* Use `alloc` since we have it in NPL

* Refactor

* Fix

* More `Vec`

* Fix

* Fix nightly-warnings

* Limit RX_STA queue

* Revert unintentional change

* esp-now: Make data private

* CHANGELOG.md

* Clippy

* MSRV

* Move locking into RawQueue

* Remove unused import

* Simplify `queue_recv`

* Address TODO

* Clippy

* Review I

* Review II

* Clarify

* Review III

* Review IV

* Review V

* Fix

* `steal` RNG and RADIO_CLOCKS

* `drop_in_place`

* De-duplicate

* Use `VecDeque`

* Revert unintentional changes

* Fix

* Update esp-wifi/MIGRATING-0.10.md

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

* assert

* Fix

* Expect `*mut ConcurrentQueue` where applicable

* Comment why stealing is fine

* Fix

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2024-10-31 12:26:10 +00:00
liebman
448ed9a001
implement a parallel interface for esp32 using the i2s peripheral (#2348)
* i2s_parallel for esp32 - partially working

* i2s_parallel for esp32 - works sync 16bit (still WIP)

* i2s_parallel - add 8-bit

* i2s_parallel - naive async implementation

* i2s_parallel - clippy

* add examples (mainly for testing now and we can reduce these before merge)

* set tx_wrx2 in 8 bit mode or it updates on half clocks!

* adjust clock config (still really a hack)

* better clock calculation/configuration

* no need to reset dma or interrupts in start, the DMA DmaTxBuf handles that

* seems to need a short delay during tx_reset

* use 20 clocks instead of 1us

* 1us delay between dma start and tx_start (like idf)

* changelog & documentation

* remove debugging functions

* no need for option in example

* make async example actually use async & remove Option

* implement Drop for I2sParallelTransfer

* fix signal offset comment for I2S0

* small cleanup in i2s_parallel examples

* added a note re I2S0 not supporting true 8bit

* update doc & fmt

* instace functions take &self

* fmt

* if run at 240MHz (CPU) delay needs to be bigger

* wait for fifo on start and fixes for 240MHz

* update for esp-hal-changes

* fmt

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2024-10-30 18:55:47 +00:00
Björn Quentin
416c1481ae
Circular dma improvements (#2409)
* Check for error when pushing into a circular dma transaction too late

* Adapt tests

* Adapt example

* Don't block forever if trxing to pop from a circular DMA transfer too late

* Have a dedicated error for circular-DMA reading/writing too late

* Stop I2S RX before resetting it

* Migration guide

* Address review comment, make CI pass

* Adopt ideas from review

* Fix

* Update esp-hal/MIGRATING-0.21.md

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

* assert

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-10-30 16:25:29 +00:00
Kirill Mikhailov
3e42b76993
Add an option to configure WDT action (#2330)
* WIP

* revert example

revert config

* changelog entry

* Make `RWDT` API work correctly, make `RWDT` and `MWDT`APIs same

* update documentation code

oops

* rev

* Polishing

* Document bootloader limitation

+ typo fix

* Address reviews

* fix documentation examples
2024-10-30 09:46:34 +00:00
Dániel Buga
8a23dbe1b6
Modernize UART interrupts (#2406)
* Modernize UART interrupts

* Also derive Debug and Format for interrupt enums

* Fix changelog

* Touch up API-GUIDELINES
2024-10-28 09:07:15 +00:00
Dániel Buga
681f4ef0aa
Implement UART type erasure (#2381)
* Simplify test

* Remove unnecessary refs

* Improve readability

* Require Instance: PeripheralMarker

* Take &self

* Avoid unsafe code on non-s2

* SImplify drain_fifo

* Simplify read_bytes

* Avoid a register read on ESP32

* Deduplicate is_idle functions

* Add missing inlines

* Move code out of trait

* Erase UART instances

* Disable LTO
2024-10-25 08:03:20 +00:00
Dániel Buga
2ac47868f7
Remove FullDuplexMode and HalfDuplexMode type params (#2373)
* Remove duplex type param

* Rename dma_ functions
2024-10-24 07:22:21 +00:00
Dániel Buga
c163b0586a
Erase TWAI (#2359)
* Swap order of generics

* Don't refer to Instance in irq handler

* Deduplicate a bit

* Take &self

* Reduce nesting

* Erase TWAI instance
2024-10-24 06:47:02 +00:00
Dániel Buga
e367c83bde
Erase i2c peripheral instances (#2361)
* Clean up

* Erase I2C instance type

* Clean up

* Implement Peripheral

* Changelog

* Remove with_timeout constructors
2024-10-23 06:31:08 +00:00
Björn Quentin
c574834ae3
Include ROM API symbols (#2374)
* Include ROM API symbols

* Fixes and CHANGELOG.md

* Fix

* Move migration steps to the right crate's migration guide

* Remove `-Trom_functions.x` where necessary
2024-10-22 10:02:49 +00:00
akesser
326e006335
doc: add hint for feature flag in wifi examples (#2365) 2024-10-18 14:14:21 +00:00
Dániel Buga
99a579973a
Preparatory i2s refactor (#2316)
* Take self

* Consolidate signal impls

* Remove traits

* Deduplicate impls

* Seal AcceptedWord

* Changelog

* Migration guide

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-10-16 13:04:00 +00:00
Scott Mabin
0142703112
I2c rename, small docs clean up (#2320)
* cleanup prelude docs

* fixups and i2c rename

* changelog and migration

* fixup docs and examples

* fix lint
2024-10-10 07:26:13 +00:00
Dániel Buga
7ca1b4376f
Erase DMA type params (#2261)
* Split PdmaChannel into two

* Take &self in PDMA traits

* Implement type-erased PDMA channels

* Remove Degraded assoc type

* Move degrade fns to base trait

* Use PeripheralDmaChannel on constructors only

* Remove WithDmaAes use

* Erase DMA type params

* Clean up examples/tests

* Remove redundant trait bounds

* Remove peripheral-specific DMA traits

* Document i2s change

* Clean up parl_io

* Deduplicate InterruptAccess

* Fix cfg

* Implement runtime compatibility check

* Clean up a bit

* Document changes

* Swap Channel type params, erase dma channel

* Unsplit traits

* Remove redundant cfg

* Fix docs

* Simplify DmaEligible

* Remove unsafe code

* Revert "Swap Channel type params, erase dma channel"

This reverts commit 415e45e44b297fd3cb55b4261c9ce151cca4b9c9.

* Allow different degraded DMA types

* Allow converting into peripheral-specific DMA channel, use it for compat check

* Erase PDMA types without AnyPdmaChannel

* Hide degrade fns for now, remove from MG

* Clean up SPI slave

* Fix QSPI test

* Fix mem2mem, fix S3 peripherals

* Fix S2

* Remove AnyPdmaChannel

* Remove PeripheralDmaChannel

* Remove unnecessary degrade call
2024-10-08 14:09:27 +00:00
Dániel Buga
f26eef646a
Remove current_millis (#2304) 2024-10-08 14:04:59 +00:00
Björn Quentin
81f93698b0
Remove unused dependencies (#2306) 2024-10-08 13:49:49 +00:00
Dániel Buga
3a9abca148
Slight TWAI corrections (#2288)
* Fix ESP32 baud rate prescaler bit

* Explicitly disable CLKOUT

* Fix brp

* Loop example

* Clean up

* Impl traits for BaudRate

* Fix H2 125k

* Avoid self-receiving transmitted frames

* Fix self-reception flag

* De-CAN

* CI, more defmt impls

* Explain raw bit manipulation

* Fix spelling
2024-10-08 13:32:22 +00:00
Scott Mabin
08030d5541
bump all semver compatible deps (#2303) 2024-10-08 12:56:30 +00:00
Björn Quentin
ca5e8560bf
Replace ESP_LOGLEVEL and ESP_LOGFILTERby ESP_LOG (#2291)
* Replace `ESP_LOGLEVEL` and `ESP_LOGFILTER`by `ESP_LOG`

* CHANGELOG.md

* Clippy

* Fail build if using the now unsupported env variables
2024-10-08 08:53:42 +00:00
Björn Quentin
038d07f5b6
Use relevant features when building documentation (#2295)
* Use relevant features when building documentation

* CHANGELOG.md and migration guide

* Fix imports
2024-10-08 07:31:56 +00:00
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
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
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
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
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
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
5324bce815
Rework locks (#2197)
* Move lock impls out of lib.rs

* Reimplement Lock using ReentrantMutex

* Reimplement Lock using ReentrantMutex

* Refactor away some duplicate lock logic

* Return owner from try_lock

* Rework critical section to avoid spinning in irq-free context

* Fail compilation on unknown architectures

* Explain what RESERVED_MASK is

* Create one lock per timer group
2024-09-20 11:05:37 +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
Scott Mabin
ba63beb3b2
Move binary logging to sys crate (#2183)
* Move binary logging to sys crate

* make ieee take radio clks by value

* rename wifi-logs to binary-logs and fix compilation

* update sys to use correct size types

* move rtc_clk_xtal_freq_get to esp-hal

* changelogs and migration guide

* s/wifi-logs/sys-logs/g

* activate log features for esp-wifi-sys

* ble log fix c2

* fix logs using latest sys rev

* fix warning
2024-09-19 15:19:54 +00:00
Dominic Fischer
5ae76d727e
Remove pin generics from I8080 (#2171)
* Remove pin generics from I8080

* Doc example

* temp

* More docs

* doc fix

---------

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-17 13:56:01 +00:00
Jesse Braham
f496579c3b
Remove the esp-hal-smartled package (#2169) 2024-09-16 17:17:26 +00:00
Dominic Fischer
d44affcbf5
Prevent screen tearing in I8080 example (#2167)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
2024-09-16 14:36:21 +00:00
Demo for summer'23
351a64937b
one typo; one misleading comment fixed (#2153)
* one typo; one misleading comment fixed

* agreed simplification
2024-09-12 20:31:24 +00:00
Dániel Buga
562c891ef9
SPI pins are no longer optional (#2133)
* SPI pins are no longer optional, rename DummyPin

* Swap QSPI test expected levels

* Tweak documentation around Level, implement PeripheralOutput

* Fmt
2024-09-12 10:59:12 +00:00
Dániel Buga
515e67092b
Remove PcntSource (#2134) 2024-09-12 08:30:16 +00:00
Danila Gornushko
b5152dcae5
Add esp-alloc to trouble ble example (#2149)
* add esp-alloc to trouble ble example

* rustfmt
2024-09-12 07:11:54 +00:00
Dániel Buga
e7dab298f5
Rename and wrap ErasedTimer (#2144)
* Rename and wrap ErasedTimer

* Also rename conversion trait
2024-09-11 20:29:21 +00:00
Dániel Buga
7a733a75db
GPIO interconnect (#2128)
* Allow accessing signal list via ErasedPin

* Replace AnyPin with more flexible signal config

* Update tests and examples

* Fix enable_from_gpio value

* Access signals from pin drivers

* DummyPin is not a pin

* Remove redundant public fns

* Various fixes, rename ErasedPin

* Changelog

* rustfmt

* Update i8080

* Typos and endless recursion

* Drop Pin suffix from traits

* Extract AF conversion

* Touch up changelog

* Clean up spi tests

* Refactor pull resistor handling

* Don't disable configured output functionality

* Clean up TODO

* Tweak docs

* Clean up examples
2024-09-11 15:15:55 +00:00
Dániel Buga
f2e0211c1b
Use AtomicPtr, explain caveats (#2110) 2024-09-11 10:39:29 +00:00