791 Commits

Author SHA1 Message Date
Dániel Buga
a24eff9bf9
Fix async SPI/DMA race condition (#869) 2023-10-25 11:50:18 +01:00
Scott Mabin
6eca968bb8
Add LLD option for all Xtensa chips (#861)
* Add LLD option for all Xtensa chips

* changelog

* Fix linkerscript for esp32s3 rtc fast ram region
2023-10-25 11:49:42 +01:00
Björn Quentin
29f3518c04
Add RISCV TRACE Encoder driver (#864)
* Add RISCV TRACE Encoder driver

* CHANGELOG.md entry
2023-10-23 13:16:27 +02:00
Jesse Braham
33bfe80d95
Prelude improvements/fixes (#860)
* Move SPI-related traits into their own preludes in the `spi` module

* Remove the `embedded-hal-async` trait re-exports and the `eh1` module from the prelude

* Update `CHANGELOG.md`
2023-10-20 06:56:17 -07:00
Jesse Braham
62a174fd06
Replace the radio module with peripheral singleton structs (#852)
* Replace the `radio` module with peripheral singleton structs

* Update `CHANGELOG.md`
2023-10-20 11:11:32 +01:00
Björn Quentin
d41e306504
Add support for 16MB octal PS-RAM (ESP32-S3) (#858)
* Add support for 16MB octal PS-RAM (ESP32-S3)

* Add CHANGELOG.md entry
2023-10-19 14:00:27 +02:00
Jesse Braham
4238a630fc
Assorted analog-related simplifications/clean up (#857)
* Remove duplicated `analog` modules, which are not necessary

* Merge the `SarAdcExt` and `SensExt` traits into a single `AnalogExt` trait

* Clean up/simplify the analog module a bit

* Update `CHANGELOG.md`
2023-10-19 13:37:14 +02:00
Jesse Braham
2d2561024f
Replace SpiNInstance marker traits with concrete types (#853)
* Replace `SpiNInstance` marker traits with concrete types

* Update `CHANGELOG.md`
2023-10-17 06:16:07 -07:00
Jesse Braham
0c8dd59163
Add a defmt feature to esp-hal-smartled (#846)
* Add a `defmt` feature to `esp-hal-smartled`

* Update `CHANGELOG.md`
2023-10-12 11:21:30 -07:00
Dániel Buga
5365031d9d Support SysTimer as timebase on ESP32-S2 2023-10-12 10:15:35 -07:00
Jesse Braham
c6af8ba88b
Assimilate lp-hal-procmacros into esp-hal-procmacros (#845)
* Assimilate `lp-hal-procmacros` into `esp-hal-procmacros`

* Update `CHANGELOG.md`
2023-10-12 06:58:37 -07:00
Jesse Braham
f81dc50748
Refactor the spi and spi_slave modules into a common spi module (#843)
* Refactor the `spi` and `spi_slave` modules into a single `spi` module

* Update import paths in examples as needed

* Extract some common types from `spi::master` into the root `spi` module

* Fix imports in examples (again)

* Documentation fixes/improvements

* Remove unnecessary re-exports

* Update `CHANGELOG.md`
2023-10-11 11:38:38 -07:00
Björn Quentin
a0ebdf0399
embassy #[main] convenience for RISC-V / Xtensa (#841) 2023-10-11 12:10:14 +01:00
Bryan Kadzban
0aa0232f1b
SPI slave support (#580)
* Duplicate spi to spi_slave

* Restore spi

* Add barebones SPI slave mode, DMA only.

This setup allows registering buffers for future transactions the master
does (lowering cs, toggling sclk, and raising cs again). The transfer
struct returned from the registration API will complete its wait() or
return true from is_done() after cs has been raised.

Copied from spi.rs, so most of the changes are deleting code that
handles e.g. segmented transfers or synchronous operations.

Fix non-c3 devices' builds

* Limit spi_slave to non-pdma devices

* SPI slave DMA example

Ensure the API "feels" right.

Since there's no way to route GPIOs to other peripherals, we choose four
other wires and bit-bang SPI for the master side, relying on the person
running the example to connect the bus.  This way we ensure the slave
code works, since we created the master ourselves.

Also, it's not really possible to use a second ESP device as the master
anyway: all the digital lines have glitches on startup, and those
glitches cause the slave's DMA engine to skip descriptors (it thinks
they're intended CS indicators); this causes it to lose data.

Then, fix the bitbang master (recording the progression here)

- When bitbanging, iterate the bits by "for _ in 0..8", instead of the
  broken "for _ in [0..8]".  The latter only runs the iteration once,
  since there's only one list given ... and because the code uses _
  instead of a real loop variable, type checking didn't save us.
- When bitbanging, send the bits out (and read them in) MSB first, since
  that's actually how we have the slave configured.

* Add changelog entry

* Split DMA prepare_transfer into two fns.

The first does everything but write to the start bit and check for an
error. The second does those. We need 2 fns because the  SPI slave needs
to start the transfer only after resetting the various afifo hardware
components (if it starts the transfer before, the first 8 bytes will be
lost when that reset happens).

Use the split fns everywhere.

Also split flush().  It needs to be pollable, so split it into one fn that
polls and one that waits until the poll returns clear. Also call the poll
fn from the is_done() fn, so we don't trample in-progress transfers.

* Make example code fill rx buffer before transfer

This way we can tell if it's ever touching certain bytes - 0xff is never
added to the master transmit buffer.

While I'm changing this, make the slave tx buffer never contain 0xff
either (go from 254 to 0).

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2023-10-10 09:00:18 -07:00
Björn Quentin
47821e6b3b
Add ULP RISC-V HAL (#840) 2023-10-10 16:32:52 +02:00
Dániel Buga
44e968f7a8
Make sure examples can actually build with defmt enabled, build some examples in CI (#810)
* Make sure examples can build with defmt

* Remove duplicate example checks

* Fix examples

* Add changelog entry

* Actually build some examples with defmt feature enabled

* Add the defmt linker script in each package's build script
2023-10-05 12:13:09 -07:00
Jesse Braham
6ab08efd6b
Do not implement async delay for SYSTIMER if the embassy-time-systick feature is enabled (#839)
* Do not implement async delay for `SYSTIMER` if the `embassy-time-systick` feature is enabled

* Update CHANGELOG.md
2023-10-05 09:35:12 -07:00
Jesse Braham
727b8e621e Clean up and simplify build scripts 2023-10-05 09:00:00 -07:00
Jesse Braham
1a23f381d3
Convert the VS Code workspace file into a standard settings file (#830)
* Convert the VS Code workspace file into a standard settings file

* Add a VS Code extensions file to suggest useful extensions
2023-10-03 06:33:43 -07:00
Scott Mabin
df4ec5b9af allow gha to detect label changes 2023-10-03 06:33:18 -07:00
Scott Mabin
93bb10f9b4
Expand embassy feature doc to explain that a time driver should be enabled too (#835) 2023-09-30 22:24:39 +08:00
Jesse Braham
edd6c16637
Replace any underscores in feature names with dashes (#833)
* Replace any underscores in feature names with dashes

* Update `CHANGELOG.md`
2023-09-29 16:36:09 +01:00
Scott Mabin
db409ffe7b
Unify the system peripheral (#832)
* Unify the system peripheral

Whilst the PCR, SYSTEM and DPORT peripherals are different, we currently
use them all in the same way. This PR unifies the peripheral name in the
hal to `SYSTEM`. The idea is that they all do the same sort of thing, so
we can collect them under the same name, and later down the line we can
being to expose differences under an extended API.

The benifits to this are imo quite big, the examples now are all identical,
which makes things easier for esp-wifi, and paves a path towards the
multichip hal.

Why not do this in the PAC? Imo the pac should be as close to the
hardware as possible, and the HAL is where we should abstractions such
as this.

* changelog
2023-09-29 08:14:50 -07:00
jneem
d819945522
Sleep support for esp32c3 (#795)
* Make the example work

* Make GPIO wakeups work

* Add example

* revert hello_rgb change

* Clean up the first hacky version

* Fix example warnings

* Add changelog entry

* Fix example comment

* Stop skipping rustfmt
2023-09-29 08:09:50 -07:00
Jesse Braham
d316e24df6
Unify the ESP32's and ESP32-C2's xtal frequency features (#831)
* Unify the xtal frequency features for ESP32 and ESP32-C2

* Group and re-organize features for `esp-hal-common`

* Update `esp-hal-smartled` and fix its CI check

* Update `CHANGELOG.md`

* Update feature names in documentation
2023-09-29 07:40:01 -07:00
Scott Mabin
ab775e7106
Fix last changelog entry (#829) 2023-09-28 14:14:33 +01:00
Björn Quentin
547f6db6ce
Add SYSTIMER ETM (#828)
* Add SYSTIMER ETM

* Remove logger-init from examples
2023-09-28 11:59:50 +02:00
Juraj Sadel
9f76798e64
Warnings cleanup and add missing PSRAM examples to the CI (#826)
* Warnings cleanup

* Add PSRAM examples to the CI
2023-09-28 08:41:55 +02:00
Jesse Braham
4db8b725e0 Remove #[rustfmt::skip] attributes and run rustfmt 2023-09-27 10:50:25 -07:00
Juraj Sadel
ca4e1b3a26
(G)DMA AES working mode support (#821)
* Add (G)DMA AES initial support

* Modify AES examples to the driver changes

* Add DMA examples(tests)

* fmt

* changelog

* review changes

* typo
2023-09-27 09:08:14 -07:00
Kirill Mikhailov
24c5e8cb79
Adding async support for RSA peripheral (#790)
* Adding async support for RSA peripheral

* Add esp32 support (doesn't work properly yet)

* Xtensa chips are supported (except of esp32)

Add modular multiplication for esp32

Adding a CHANGELOG entry

Rebase issue fix

* Code cleanup

* Add `.await` on `RsaFuture::new()` calls

* Refactor and rebase

Made `read_results` functions to be `async`, got rid of `nb` usage

* Change API methods naming + refactor `start_step2` method

* Adjust example to the API change + documentation

* Code cleaning + refactoring

Update examples
2023-09-27 09:03:06 -07:00
Dániel Buga
ae160d66c3
Try to fix defmt in DefaultHandler (#813) 2023-09-27 16:32:59 +01:00
Björn Quentin
94cd593a45
Make sure to use ESP32Reset - not Reset as entry (#823)
* Make sure to use ESP32Reset - not Reset as entry

* Add CHANGELOG.md entry
2023-09-27 16:13:17 +02:00
Jesse Braham
0064766ef2
No longer publicly expose the PeripheralClockControl struct (#817)
* No longer publicly expose the `PeripheralClockControl` struct

* Update examples as needed to get things building again

* Update CHANGELOG.md

* Address review feedback, fix a warning

* Use a critical section for all devices other than the ESP32-C6/H2, as they modify multiple registers

* Rebase and update `etm` driver to fix build errors
2023-09-26 09:07:57 -07:00
bjoernQ
b2da71aca0 Document the lp_gpio module 2023-09-26 06:33:54 -07:00
Björn Quentin
774d5c4f21
Add ETM, Add GPIO ETM (#819)
* Add ETM, Add GPIO ETM

* Add CHANGELOG.md entry
2023-09-26 12:56:09 +02:00
Jesse Braham
841830dd7f Add missing examples to CI workflow 2023-09-25 11:02:23 -07:00
Jesse Braham
b91b3b1b77
Implement embedded_hal_async::delay::DelayUs trait for SYSTIMER alarms (#812)
* Implement `embedded_hal_async::delay::DelayUs` trait for `SYSTIMER` alarms

* Update CHANGELOG.md

* Address review feedback
2023-09-25 07:33:47 -07:00
Mariusz Białończyk
56b8eddb22
Update CHANGELOG.md (#815) 2023-09-25 09:23:37 +02:00
jneem
ced8088fe9
Make ADC reads return u16s, not generic types (#792)
* Make ADC reads return u16s, not generic types

* Changelog entry

* Add the PR number to the changelog

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2023-09-22 07:49:59 -07:00
Scott Mabin
eeb2d1db6f
Fix UART to handle CPU/APB clock changes (#808)
* Ensure that uart is configured to account for clock changes, not just boot defaults

* fix examples

* changelog

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2023-09-21 09:06:56 -07:00
Björn Quentin
24edf7bdc4
Async PARL_IO support (#807)
* Async PARL_IO support

* Add CHANGELOG.md entry
2023-09-21 17:34:53 +02:00
Dániel Buga
996ec49878
Optimize multicore critical section impl (#797)
* Optimize multicore critical section impl

* Assert reserved bits, explain bit choices, remove redundant checks

* Don't assume the bit reads as 0

* Simplify code generated for thread_id()

* Use non-0 value for unlocked

* Optimise release

* Assume reserved bits read as 0

* Add changelog entry

* Clean up warning

* Fix direct boot ld
2023-09-21 15:59:53 +01:00
Sergio Gasquez Arcos
a4edb0dfc9
Fix SHA registers access (#805)
* fix: Fix SHA registers access

* build: Update esp32s3 pacs

* docs: Update changelog
2023-09-21 06:18:56 -07:00
Mariusz Białończyk
240b2057f6
esp-hal-common: uart/ESP32: fix get_rx_fifo_count() (#804)
Currently the `get_rx_fifo_count()` is using `fifo_cnt`, which is unreliable
for ESP32, according to the errata:
https://www.espressif.com/sites/default/files/documentation/esp32_errata_en.pdf
section 3.17

This commit is fixing the code for the ESP32 according to the
workaround example.

Main discussion and my debugging results:
https://github.com/esp-rs/esp-hal/discussions/765
2023-09-21 12:25:31 +08:00
Björn Quentin
434a32763c
Async I2S support (#801)
* Async I2S support

* Add CHANGELOG.md entry
2023-09-20 22:23:50 +00:00
Georges
107732b111
Add support for splitting esp32 uart into TX and RX (#754)
* Add support for splitting esp32 uart into TX and RX

* Keeps existing API for uart, but wraps it in Tx and Rx sub-types
* Adds split() method similar to embassy-rs nRF/stm32/rp for getting indepdendent TX and RX
parts
* Implements e-h traits for TX and RX types
* Add esp32s3 example

* finish implementing

* rebase examples

* declare new examples

* fix fmt

* rebase on 0.12.0

* fix fmt

* fix fmt

* merge embassy_serial_split example with embassy_serial

* fix changelog

* fix changelog
2023-09-20 13:19:34 +01:00
Juraj Sadel
856f0d1881
ECC peripheral support for ESP32C2, ESP32C6, and ESP32H2 (#785)
* Add ECC driver for ESP32C2 and ESP32C6

* Add ECC example for ESP32C2 and ESP32C6

* Add and modify dependencies

* ESP32H2: Add ECC driver support

* ESP32H2: Add ECC example

* ESP32C2 and ESP32C6: clean examples

* changelog

* refactor: remove enable_interrupt() and clear_interrupt()

* refactor: remove ugly if/else logic for padding
2023-09-19 05:24:32 -07:00
Jesse Braham
2badf86705
Bump the MSRV to 1.67, check the defmt feature in MSRV check (#798)
* Bump MSRV to 1.67, check with `defmt` feature enabled in MSRV checks where applicable

* Add `esp32c6-lp-hal-procmacros` package to VS Code workspace

* Update `CHANGELOG.md`
2023-09-19 05:19:55 -07:00
Dániel Buga
6d936680ea
Fix s3 RC_FAST_CLK powerdown (#796) 2023-09-18 12:45:09 +02:00