Commit Graph

265 Commits

Author SHA1 Message Date
dimi
3d49ed7294 fix MCPWM typos 2023-03-06 06:46:49 -08:00
Scott Mabin
edfa9c83fd radio impls
- also add blanket impls for &mut Sealed and &mut Peripheral
2023-03-01 08:51:34 -08:00
Jesse Braham
984b7fc042
Refactor chip-specific code into esp_hal_common::soc module (#412)
* Create an `soc` module with a submodule for each chip, move `peripherals` in

* Move the `cpu_control` module into `soc`

* Move the `efuse` module into `soc`

* Refactor type definitions from `gpio` module into `soc`

* Put all embassy-related files in a common directory

* Change visibility of `GpioPin` constructor
2023-02-28 07:49:41 -08:00
bjoernQ
3ae95674e9 Fix spi.dma_write 2023-02-27 09:26:00 -08:00
Jesse Braham
d293d9f162
Add support for the ESP32-C6 (#392)
* Create the `esp32c6-hal` package

* Teach `esp-hal-common` about the ESP32-C6

* Get a number of peripheral drivers building for the ESP32-C6

bckup

initial clocks_ii

* Create the `esp32c6-hal` package

C6: update

* Simplify and fix the linker script

update

* C6: add I2S

* Create the `esp32c6-hal` package

* Teach `esp-hal-common` about the ESP32-C6

* Get a number of peripheral drivers building for the ESP32-C6

bckup

initial clocks_ii

* Create the `esp32c6-hal` package

* C6: update

* Simplify and fix the linker script

* update

* C6: add I2S

* update

* C6 Interrupts

* C6: Update build.rs, linker scripts and initial examples

* C6: RMT

* Fix interrupt handling

* Fix `ClockControl::configure`

* C6: revert to I2S0 instead of just I2S

* C6: rebase and update

* RTC not buildable

* Implement RWDT and SWD disable

* C6: working LEDC

* C6: working RMT

* C6: add aes

* C6: add mcpwm

* C6: add rtc_cntln - not finished

* C6: update and formatting

* C6: add pcnt

* C6: add examples and format

* Remove inline assembly, fix interrupts and linker scripts

* Remove unused features, update cargo config for atomic emu, misc cleanup

* Get ADC building and example "working" (as much as it ever does)

* Remove a bunch of unused constants which were copied from ESP-IDF

* The `mcpwm` example now works correctly

* Get `TWAI` peripheral driver building for C6

* Clean up the `rtc_cntl` module and get all the other HALs building again

* Add the C6 to our CI workflow

* Fix various things that have been missed when rebasing

Still missing a few examples (`clock_monitor`, `embassy_spi`, `ram`)

* C6: Small updates in wdt (#1)

* C6: Update WDT

* C6: Update examples with WDT update

* Update `esp-println` dependency to fix build errors

* Fix formatting issues causing pre-commit hook to fail

* Get some more examples working

* Working `ram` example

* Sync with changes in `main` after rebasing

* Working `embassy_spi` example

* Use a git dependency for the PAC until we publish a release

* Fix I2S for ESP32-C6

* Fix esp32c6 direct boot (#4)

* Add direct boot support for C6

* Fix direct boot for c6

- Actually copy into rtc ram
- remove dummy section that is no longer needed (was just a waste of
  flash space)
- Move RTC stuff before the no load sections

* Update RWDT and refactor RTC (#3)

* C6: Update RWDT and add example, refactor RTC and add not-really-good example

* Update based on review comments, resolve bunch of warnings and run cargo fmt

* Update C6 esp-pacs rev commit

* Fix clocks_ll/esp32c6.rs

* Fix riscv interrupts

* Remove clock_monitor example for now

* RAM example works in direct-boot mode

* Add a TODO for &mut TIMG0 and cargo fmt

* Fix linker script after a bad rebase

* Update CI and Cargo.toml embassy required features

* use riscv32imac-unknown-none-elf target for C6 in CI

* change default target to riscv32imac-unknown-none-elf

* add riscv32imac-unknown-none-elf target to MSRV job

* another cleanup

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Jesse Braham <jesse@beta7.io>

* Make required changes to include new `RADIO` peripheral

* Use published versions of PAC and `esp-println`

* Use the correct target extensions (`imac`)

* Fix the super watchdog timer, plus a few more examples

* Fix UART clock configuration

* Make sure to sync UART registers when configuring AT cmd detection

* Disable APM in direct-boot mode

* Address a number of review comments

* Fix `SPI` clocks and `rtc_watchdog` example  (#6)

* fix SPI clocks

* run cargo fmt

* Add comment about used default clk src

* Fix rtc_watchdog example in BL mode

* run cargo fmt

* Update rtc_watchdog example that it works in DB mode

* README and example fixes/cleanup

* Add I2C peripheral enable and reset

* Fix `ApbSarAdc` configuration in `system.rs`

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Scott Mabin <scott@mabez.dev>
2023-02-27 09:15:44 -08:00
Jesse Braham
bfa1bd901e New releases for esp-hal-common and esp32c2-hal packages 2023-02-22 11:19:42 -08:00
C2D
862b8580b7 Fix the SPI alignment fix 2023-02-21 11:44:36 -08:00
Jesse Braham
d3969c3130 New releases for all HAL packages 2023-02-21 07:43:44 -08:00
Scott Mabin
80996e3b6e
Add RADIO peripheral (#397)
* Allow the creation of peripherals _not_ from the pac in the peripherals macro

* Add RADIO peripheral

- Remove DerefMut hack, replace with proper Sealed impls
- Add RADIO peripheral for all chips

* Add RADIO peripheral with split method into each radio feature
2023-02-21 07:08:08 -08:00
bjoernQ
a01ecedb0f Fix hidden alignment requirement (SPI) 2023-02-20 12:53:52 +01:00
RepeatedRoot
912ab3008e
add support for 26mhz esp32 2023-02-16 16:54:26 +10:30
Björn Quentin
4e88e48bbe
Remove unnecessary rt crate dependencies (#391)
* Remove unnecessary `rt` crate dependencies

* Bump versions, update to latest released dependencies
2023-02-10 07:24:12 -08:00
Björn Quentin
ab9aeb2443 AnyPin 2023-02-08 14:31:54 +01:00
bjoernQ
e581f7c212 Fix (I2S) circular DMA 2023-02-08 13:14:36 +01:00
Björn Quentin
7c2da6a4a3
Merge pull request #390 from bjoernQ/bugfix/allow-into_analog-for-InputOnlyAnalog-pins
Allow `into_analog` for all analog capable pins
2023-02-08 13:01:10 +01:00
Scott Mabin
3f7181fece
Async SPI (#385)
* ground work for async dma (gdma only atm)

* Add async DMA (GDMA) - esp32c3/esp32c2

* Add Async SPI impl for esp32c3/c2

* Remove private modules from DMA

* add async spi example for esp32c3

* Switch to assoc wakers instead of a static array

* add support for esp32/esp32s2

* add support for esp32s3

* run fmt

* add c2 example, fix CI

* Remove redundant comments
2023-02-08 11:02:03 +00:00
bjoernQ
08c01355ae Allow into_analog for all analog capable pins 2023-02-08 10:27:46 +01:00
Jesse Braham
75f7394986 Fix the references to the ets_update_cpu_frequency_rom ROM function 2023-01-31 09:13:22 -08:00
Jesse Braham
cf270700e7
Use the new esp-riscv-rt package for RISC-V HALs (#365)
* Update PACs and modify `esp-hal-common` to use new `esp-riscv-rt` package

* Update `esp32c2-hal` and `esp32c3-hal` to use `esp-riscv-rt` as well

* Update all RISC-V examples to use `esp-riscv-rt`

* Update RISC-V trap frame handling according to review feedback
2023-01-27 10:49:38 -08:00
Scott Mabin
0eac22eba1
Async: GPIO (#333)
* Add `is_listening` to `Pin` trait

* Add `Wait` impl for Gpio Input

* Add GPIO wait example for C3

* Ensure correct bank is accessed in interrupt

* Add esp32c2 wait example

* Add esp32s3 wait example

* Add esp32s2 wait example

* Add esp32 wait example

* Run fmt

* Add example to cargo tomls

* Add top level docs for embassy examples

* Mention the higher MSRV for async in the README

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2023-01-27 10:44:08 -08:00
Jesse Braham
d6c4e3e43f Update the name of the INTERRUPT peripheral to INTERRUPT_CORE0 2023-01-27 07:06:07 -08:00
Jesse Braham
d03c267084 New releases for all HAL packages 2023-01-26 08:51:24 -08:00
Scott Mabin
573c517235
Allow Debug interrupts in Xtensa critical sections (#360) 2023-01-25 09:54:49 +00:00
mhead
586276fd34 aes accelerator implementation 2023-01-24 10:04:57 -08:00
Scott Mabin
5f933aa7c1
Only set the set_suc_eof flag on the last item (#359)
It was previously hardcoded to true, which meant a DMA suc eof interrupt would fire for every descriptor that was processed
2023-01-24 09:17:24 +01:00
Jesse Braham
832f9ef4d4
Refactor the clock module, provide ROM functions via linker scripts (#353)
* Refactor `clock` and `clocks_ll` into a common module

* Add a ROM function linker script to each HAL and provide some functions

* Use the provided ROM functions instead of transmuting addresses

* Fix CI workflow for ESP32-S2
2023-01-23 07:12:33 -08:00
Björn Quentin
1ec6f98602
Make DMA marker traits available to users (#356)
* Make DMA marker traits available to users

* Fix EH1

* Hint about the descriptor size on the `dma.configure()` function
2023-01-23 14:10:25 +00:00
Jesse Braham
7f8a15ccf5
Refactor rtc_cntl module and add get_reset_reason function (#351)
* Refactor the `rtc` and `rtc_cntl` modules into a common `rtc_cntl` module

* Implement the `get_reset_reason` and add `SocResetReason` enum for each chip
2023-01-19 06:51:22 -08:00
Jesse Braham
d29c4b1dcf
Update a number of dependencies to get RISC-V HALs building again (#350)
* Update `riscv`, `riscv-rt` dependencies, plus PACs for RISC-V chips

* Update `riscv-atomic-emulation-trap` package

* Update the `embassy-executor` dev dependency to a newer version
2023-01-18 14:08:30 -08:00
liebman
ac206af656
pulse counter implementation (#328)
* start of pulse counter implementation

* implement interrupts
implement pcnt for esp32, esp32s2, and esp32s3

* implement pcnt for esp32s2

* fix esp32 PCNT signal names

* update PCNT register/fields for cleaned up PAC

* implement events/get_events (choosing what events interrupt)

* added pcnt example: simple encoder configuration

* restrict pcnt::channel::Channel::new() to super

* PcntPin -> PcntSignal
added range checks for thresholds and limits

* PcntSource is a better name I think

* handle error for PCNT Unit configure() in example

* update pac versions for status register change

* cargo fmt

* cargo fmt (examples)

* PcntSource now only stores the source id.
add a critical section to protect the ctrl & isr_en registers

* cargo fmt
2023-01-17 17:04:22 +00:00
Scott Mabin
9d988b3ec8 Remove the signals from the GPIO structs, instead have a signals struct which can access the signals 2023-01-06 08:22:50 -08:00
Björn Quentin
a0b976d078
Fix GPIO interrupts for pins > 31 (#335)
* Fix GPIO interrupts for pins > 31

* Align InteruptRegister and GpioRegisterAccess
2023-01-06 13:57:09 +01:00
Scott Mabin
f618490dcb
Finish PeripheralRef (#334)
- Remove the mixed pac and generated peripherals, instead all are
  generated.
2023-01-06 11:35:57 +00:00
Jesse Braham
fe6ea5321b Use the latest PACs 2023-01-04 08:56:56 -08:00
dimpolo
ba43157c5a
enable TWAI on ESP32-S3 (#325)
* enable TWAI on ESP32-S3

* add esp32-s3 TWAI example
2023-01-03 10:02:01 -08:00
Alex Bohm
1f6803776c
Initial TWAI Driver Implementation (#192)
* wip: initial implementation of transmission only.

* Moved TWAI to its own directory and added initial reception of packets.

* Added extended id transmit and receive.

* Added maybe better code for making packet filters.

* Fixed bug with ids and improved methods of copying data to the peripheral.

* Added some guards against Bus Off

* Added reception of remote frames.

* Clean up of comments, etc

* Updated TWAI naming and cleaned up example a bit.

* Updated bitselector to include better unpacking methods.

* Add embedded-can and limit initial TWAI implementation to esp32c3.

* Added embedded-can to esp32c3 twai example.

* Switched twai filter to using bytestrings.

Co-authored-by: dimi <dimi.polonski@gmail.com>

* Implemented new() for twai filters.

* Clean up TWAI docs and example.

* Fix filter constructors and add examples.

* pre driver PeripheralRef update.

* PeripheralRef/twai

* Format comments with nightly rustfmt.

* Add gpio PeripheralRef and use volatile for direct register access.

Co-authored-by: dimi <dimi.polonski@gmail.com>
2022-12-22 00:54:06 +00:00
Scott Mabin
452fde2c12
Peripheral ref/gpio (#323)
* Implement Peripheral for all GPIO pins

* Update i2c & i2s to use the new gpio peripherals ref

* gpio pref: usb

* gpio pref: pulse control (RMT)

* gpio pref: spi

* gpio pref: uart

* gpio pref: ledc

* gpio pref: mcpwm

* fixup smartleds to use new pulse controller traits

* dump msrv

* bump rust-version in cargo tomls
2022-12-19 14:40:29 +00:00
Juraj Sadel
4598df6ed6
Peripheral ref/adc (#321)
* PeripheralRef: ADC

* PeripheralRef: DAC
2022-12-15 16:03:38 +01:00
Björn Quentin
4a780bd1f5
PeripheralRef: TIMG (#320) 2022-12-15 14:03:41 +01:00
Björn Quentin
5ebd800d0e
PeripheralRef: RTC (#319) 2022-12-15 11:21:13 +01:00
Björn Quentin
945a0d66c1
PeripheralRef: USB_OTG (#318) 2022-12-15 09:29:01 +01:00
Björn Quentin
a90aa3a2cc
PeripheralRef: DMA (#317) 2022-12-15 08:12:43 +01:00
Scott Mabin
c6a6010443
PeripheralRef: MCPWM (#314) 2022-12-14 16:42:30 +01:00
Björn Quentin
42f6f8ac4a
PeripheralRef for ClockControl (#316) 2022-12-14 15:09:46 +00:00
Juraj Sadel
ca4c573660 PeripheralRef: I2S 2022-12-14 15:09:19 +01:00
Scott Mabin
3a57eb98fe
Completely remove pac references in hal drivers (#309)
* Peripheral ref/sha (#312)

* Add SHA to list of peripherals to be created

* Refactor SHA peripheral to use PeripheralRef

* Update SHA examples to get them building again

* Fix async time drivers

* Fix usb otg

* Fix s3

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2022-12-14 13:15:45 +00:00
Jesse Braham
220f812625
Peripheral ref/sha (#312)
* Add SHA to list of peripherals to be created

* Refactor SHA peripheral to use PeripheralRef

* Update SHA examples to get them building again
2022-12-14 12:19:53 +00:00
Juraj Sadel
7817e270c2
PeripheralRef: RMT (#310) 2022-12-14 11:47:50 +00:00
Scott Mabin
a9661e68be
Peripheral ref/rng (#306) (#307)
* Add RNG to list of peripherals to be created

* Refactor RNG driver to use PeripheralRef

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2022-12-14 09:34:43 +00:00
Jesse Braham
f2b59538df
Peripheral ref/rng (#306)
* Add RNG to list of peripherals to be created

* Refactor RNG driver to use PeripheralRef
2022-12-14 09:20:01 +00:00