Commit Graph

1822 Commits

Author SHA1 Message Date
har7an
26a5029edf
common/gpio: Allow disconnecting IO from peripheral (#147)
* common/gpio: Allow disconnecting IO from peripheral

* common/gpio: Allow disconnecting input from peripheral

* common/gpio: Document functions for disconnecting

IOs from peripherals.

* common/gpio: Use generic alternate function

passed in from the gpio configuration.
2022-08-16 08:52:07 -07:00
Gustavo Henrique Nihei
3cbabe3247
ESP32[-C3]: Fix broken references in documentation (#153)
* esp32c3: Fix broken references to esptool repository

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32: Fix broken reference to esp-idf repository

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-08-16 08:32:47 -07:00
Björn Quentin
97d1c1e997
Merge pull request #152 from gustavonihei/bugfix/early_rwdt_disable
rtc: Disable Flashboot mode when disabling RTC Watchdog timer
2022-08-16 17:25:19 +02:00
Gustavo Henrique Nihei
a7c788ff02 rtc: Disable Flashboot mode when disabling RTC Watchdog timer
This commit fixes a regression to Direct Boot support introduced on
routine.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-08-16 11:43:57 -03:00
Björn Quentin
978b322b94
Merge pull request #148 from bjoernQ/bugfix/fix-esp32c3-linker-error
Fix ESP32-C3 builds on latest nightlies
2022-08-16 10:04:14 +02:00
bjoernQ
49841c295d Fix ESP32-C3 builds on latest nightlies 2022-08-16 09:42:36 +02:00
Björn Quentin
35e568dd38
Merge pull request #145 from esp-rs/bugfix/db-bss-section
include bss size when calculating rwtext address
2022-08-10 08:31:16 +02:00
Scott Mabin
99ae152f55 Fix bss section placement in db mode
If bss contained anything a linker error was emitted about overlapping
sections. Moving the .bss section to after the .rwtext, and adding a dummy
section to pad data bus access to the bss section fixes this.
2022-08-09 23:51:28 +01:00
bjoernQ
91373ac6a0 Make RMT TX larger than one block work on ESP32-C3 and ESP32-S3 2022-08-09 16:30:19 +02:00
Björn Quentin
4c44f3ea8e
Merge pull request #139 from gustavonihei/feature/rwdt_esp32_s2_s3
rtc: Add RWDT examples for ESP32, ESP32-S2 and ESP32-S3
2022-08-09 08:28:51 +02:00
Gustavo Henrique Nihei
a33c0de7f6 rtc: Add RWDT examples for ESP32, ESP32-S2 and ESP32-S3
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-08-08 13:34:22 -03:00
Gustavo Henrique Nihei
91ea205446
ESP32-C3: Add driver for RTC Watchdog Timer (RWDT) (#134)
* esp32: Fix typo in Frequency word in some identifiers

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3: Add support for PLL clock configuration

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* clock: Move definition of Clock types to common level

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3: Add support for RTC Clock configuration

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3: Add example for the RTC Watchdog Timer driver

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-08-08 15:36:19 +01:00
Björn Quentin
98d0fe8ece
Merge pull request #138 from bjoernQ/bugfix/fix-ledc-clock
Fix LEDC divider calculation, use REF_TICK when needed
2022-08-08 15:28:58 +02:00
bjoernQ
c19a1fa13f Cleanup ESP32-S3 LEDC example 2022-08-08 15:15:30 +02:00
bjoernQ
275cede963 Fix LEDC divider calculation, use REF_TICK when needed 2022-08-08 14:41:55 +02:00
Björn Quentin
2a1ab6da0e
Use the correct AlternateFunction for GPIO (#137) 2022-08-08 12:02:40 +01:00
Jesse Braham
82371f526c Add jobs to the CI workflow to verify the MSRV 2022-08-03 17:12:18 +02:00
Andreas Hartmann
525c6054ba procmacros: Replace then_some
which was just [recently stabilized in rust 1.62.0][1] and hence raises
the MSRV to 1.62.0 for all HALs. Use `bool::then` instead, which takes a
closure instead of a parameter but has the same effect otherwise and is
available [since rust 1.50.0][2].

[1]: https://github.com/rust-lang/rust/pull/96628
[2]: https://doc.rust-lang.org/stable/std/primitive.bool.html#method.then
2022-08-03 16:59:23 +02:00
Jesse Braham
601d70dd9a
Refactor the LEDC driver to reduce code duplication (#130) 2022-08-03 14:48:45 +01:00
Juraj Sadel
4d4b60a2a0
Merge pull request #114 from JurajSadel/feature/LEDC
Add basic LEDC support for esp32, esp32c3, esp32s2 and esp32s3
2022-07-30 19:37:18 +02:00
Juraj Sadel
ec6b58ee7d Add basic LEDC support for esp32, esp32c3, esp32s2 and esp32s3 2022-07-29 12:22:27 +02:00
Gustavo Henrique Nihei
224e84d9dc
Move Super Watchdog functions into RTC_CNTL common implementation (#125)
* esp32c3: Move SWD functions into RTC_CNTL common implementation

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32s3: Extend SWD functions to ESP32-S3

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-07-27 13:37:37 -07:00
bjoernQ
83ac67be23 Make it easy to leave out some of the SPI pins 2022-07-27 16:14:40 +02:00
Björn Quentin
ffc6c16575
Fix invocation of esp32_update_cpu_freq (#124)
* Fix invocation of esp32_update_cpu_freq

* Update comment for `esp32_update_cpu_freq`
2022-07-27 14:24:26 +01:00
Björn Quentin
1bf89b3b22
Merge pull request #121 from esp-rs/perf/improve-vectored-intr-latency
perf: vectored interrupt improvements
2022-07-27 08:22:58 +02:00
Scott Mabin
de379897a9 perf: vectored interrupt improvements
Instead of building a table of _all_ configured interrupts,
we now only check the currently _pending_ interrupts configuration
status. This means in the best case scenario we only ever do _one_
lookup instead of the 60~ we did before.

Tested on esp32c3, gpio_interrupt:

Before: 850cycles from `handler_interrupts` to the actual handler
After: 125cycles
2022-07-26 23:30:50 +01:00
Scott Mabin
1d02bf87c3
RISCV vectored interrupts (#118)
* RISCV interrupt vectoring

- Adds support for vectoring peripheral interrupts to PAC handlers
- Currently supports level interrupts with priorities from 1-15
- Updated the gpio interrupt example to reflect the new changes

* remove .vscode files

* Support vectored edge interrupts

This is as simple as making sure we clear the CPU interrupt whenever we
receive one. This also documents further what APIs are safe to call when
the `vectored` feature is enabled.

* fix all examples to use vectoring

* doc & cleanup

* run handlers from ram

* make xtensa::interrupt::vectored private, we rexport public items

* fix default handlers

* pass interrupt into EspDefaultHandler
2022-07-26 09:24:47 -07:00
Scott Mabin
1789780d06
Xtensa vectored interrupts (#103)
* Xtensa interrupt vectoring: peripheral source

- Initial Xtensa vectoring, updated esp32 gpio example to use new interrupt macro.
- Only peripheral sources supported.
- Only level one priority supported.
- CPU & Edge interrupts still need to be handled.

* Xtensa interrupt vectoring: CPU & EDGE

- Add support for handling CPU interrupts and edge interrupts
- PR required to xtensa-lx-rt for CPU handlers

* Xtensa interrupt vectoring: Priority

- Finally implement priortization
- Only three priorities available at the moment. Xtensa programmer guide
  discourages using highpri interrupts in Rust/C. Guide also mentions
  using software priortization to increase the number of Priorities
  available

* support CPU interrupts, using patch xtensa-lx-rt

* Update example

* Add support & examples for the s2 & s3 too

* Fix formatting and missing imports

* Run interrupt handling in ram, optionally run the vector handler in ram in the examples

* Use xtensa_lx::Mutex CS when enabling interrupts

* Run clippy on each target

* Remove redundant features

* Fix C3 builds

* make enable unsafe. Add note about preallocated interrupts in vectored mode.

* Remove `INTERRUPT_LEVELS` static

The interrupt levels static introduces a few issues
  - A lock is needed when configuring interrupts to keep
    INTERRUPT_LEVELS in a consistent state
  - Interrupts enabled from outside the Rust domain wouldn't be
    serviced, this is the case with the wifi blobs

To remove it, the prioty configuration is now calculated dynamically in
the interrupt handler. Essentially INTERRUPT_LEVELS is now created once
the interrupt triggers. It has some benefits, such as only having to
look at interrupts configured on the current core, not both, but there
is of course an overhead with doing this in the interrupt.

* Allow raw interrupts on levels 4-7, whilst also supporting vectoring on levels 1-3

* rename core number features

* Fix examples and formatting

* use xtensa-lx-rt release, update pacs

* Support passing the trap frame into interrupt handlers

* cfg away the #[interrupt] macro when not using vectoring

* rename enable to map

move vectored feature to chip specific hals

* export vectored functions

- rename `enable_with_priority` to `enable`
- add docs for interrupt macro

* Update all examples to use vectored interrupts
2022-07-25 07:12:34 -07:00
bjoernQ
34b1e09662 CPU clock settings for ESP32-S2 and ESP32-S3 2022-07-22 16:09:38 +02:00
Björn Quentin
93b7be218d
Merge pull request #112 from bjoernQ/improve-examples-documentation
Add more documentation to the examples
2022-07-22 12:08:52 +02:00
bjoernQ
70a9437f27 Add more documentation to the examples 2022-07-22 11:41:58 +02:00
Björn Quentin
faf646375f
CPU clock settings for ESP32 and ESP32-C3 (#110)
* CPU clock settings for ESP32 and ESP32-C3

* Minor improvements to the ESP32 clock setting code
2022-07-21 21:38:46 +01:00
Björn Quentin
d201d160fa
Merge pull request #109 from jessebraham/fixes/updates
Disable `smartled` feature by default and update `xtensa-lx-rt` dependency
2022-07-20 20:25:20 +02:00
Jesse Braham
a5bdab7316 Update the CI to include the hello_rgb example in checks again 2022-07-20 10:44:04 -07:00
Jesse Braham
4ba610d38d Do not enable the smartled feature by default 2022-07-20 10:38:48 -07:00
Jesse Braham
2a00119f94 Update the xtensa-lx-rt dependency to the newest version 2022-07-20 10:37:02 -07:00
Björn Quentin
9fa1d1ecdb
Add direct-boot support for ESP32-S3 (#107)
* Add direct-boot support for ESP32-S3
* Make sure to use correct alignments
* Only enable naked_functions and asm_experimental_arch when direct-boot feature is selected
2022-07-20 07:14:19 -07:00
Björn Quentin
147d8de988
Separate TIMG into timer0, (timer1), wdt (#104)
* Separate TIMG into timer0, (timer1), wdt
* Apply suggestions from code review
* Remove left-over code
* Ignore settings.json
2022-07-20 06:51:39 -07:00
bjoernQ
907d43ed6f Pin the PAC dependencies 2022-07-15 12:14:27 +02:00
bjoernQ
35a58490c6 Additional UART/Serial features 2022-07-13 22:46:34 +02:00
Jesse Braham
b69423451f Bump the riscv-rt dependency version 2022-07-13 08:21:36 -07:00
Björn Quentin
e612bd1120
Add some config options to the UART driver (#99)
* Add some config options to the UART driver
* Use esp-println 0.2.0
* Remove the NoPin type
* Serial constructor now doesn't return a Result anymore
2022-07-12 08:00:02 -07:00
bjoernQ
887798fd6f Reading raw ADC data for ESP32-C3 2022-07-07 18:39:11 +02:00
bjoernQ
568e37c166 Reading raw ADC data on ESP32 and ESP32-S2 2022-07-07 17:55:26 +02:00
bjoernQ
1655e36c31 Implement starting a task on second core of ESP32 and ESP32-S3 2022-07-05 17:41:55 +02:00
Jared Moulton
45060bb684 Add WIP hal-1.0 SPI traits
This implemnts the functionality for SpiBusFlush and SpiBusWrite traits
2022-07-04 19:03:39 +02:00
Björn Quentin
98b24ae34e
Merge pull request #94 from bjoernQ/bugfix/allow-sub-seconds-timer-timeouts
Allow sub-seconds timer timeouts
2022-07-01 10:08:03 +02:00
bjoernQ
b48e9c30a3 Allow sub-seconds timer timeouts 2022-07-01 09:51:28 +02:00
Björn Quentin
7e25eebd8d
Implement DAC support for ESP32/ESP32-S2 (#92)
* Implement DAC support for ESP32/ESP32-S2
* Adapt the DAC samples after rebase
2022-06-30 11:57:16 -07:00
Björn Quentin
5414c46f6d
Merge pull request #91 from jessebraham/fixes/timer
Convert the `Timer` to take time units for countdown instead of `u64`
2022-06-30 08:44:15 +02:00