* Add macro to create DMA buffers and descriptors
* Remove WDT disabling from remaining examples
* CHANGELOG.md entry
* Remove redundant `unsafe`
* Easier way to make RX and TX same sized
* make pins optional for Spi::new (master, full-duplex mode)
* add additional method to setup spi pins (master, full-duplex mode)
* add additional method to setup spi pins (master, half-duplex mode)
* remove generic type parameters for Spi::new
* update documentation
* make `with_pins` could be chained
* update CHANGELOG.md
* update CHANGELOG.md
* make the return value of a method like `with_{*}` owned
* fix (maybe?) all broken examples caused by the change (esp32-hal)
* fix (maybe?) all broken examples caused by the change (esp32c2-hal)
* fix (maybe?) all broken examples caused by the change (esp32c3-hal)
* fix (maybe?) all broken examples caused by the change (esp32c6-hal)
* fix (maybe?) all broken examples caused by the change (esp32h2-hal)
* fix (maybe?) all broken examples caused by the change (esp32s2-hal)
* fix (maybe?) all broken examples caused by the change (esp32s3-hal)
* rerun 'cargo fmt' for esp-hal-common
* rerun 'cargo fmt' for the rest of examples
* 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`
* 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`
* 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>
* 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
* 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
* Add the peripheral module plus some helper macros in preparation
* peripheral macro
* Add peripheral generation macro
* Fixes after rebase
* Update the signature of Peripherals::take
* syncronise hello world example
* fmt the entire repo
Co-authored-by: Jesse Braham <jesse@beta7.io>