104 Commits

Author SHA1 Message Date
ivmarkov
2af4695aac
Remove Peripheral/PeripheralRef (#529)
* Remove Peripheral/PeripheralRef

* Make ADC unit and channel structs more readable by avoiding const generics

* Remove unused parameter

* fix forgotten reference to the old ADCU syntax

* Mention that we have removed the prelude module

* try_into methods for changing the pin type
2025-09-03 14:13:32 +03:00
ivmarkov
7493fb487b Remove the PCNT example for ESP-IDF 6+ 2025-08-13 09:17:27 +00:00
ivmarkov
a67bf2fd3d
Compatibility with ESP-IDF 5.4.x, 5.5.x and master (#541)
* Compatibility with ESP-IDF 4.x, 5.x and master

* Run main CI againzst released ESP-IDF
2025-08-13 09:02:33 +03:00
ivmarkov
3895fdfbe7 Fix CI 2025-07-19 06:44:48 +00:00
ivmarkov
97a6be5db7 Fix CI 2025-07-19 06:13:41 +00:00
ivmarkov
c5d1501b1b Fix CI 2025-07-19 05:56:14 +00:00
ivmarkov
339b2425db Clippy 2025-04-27 18:29:22 +00:00
Andrew Kovaliov
26a598e21b
ledc: add fade stop (#525)
* ledc: add fade stop

* ledc: fix fade stop

* ledc: fix fade stop

* ledc: fix fade stop example
2025-04-05 09:36:20 +02:00
Joseph Johnson
7b3619d712
Pcnt example (#524)
* change gpio pins for pcnt_rotary_encoder example

* add pcnt_rotary_encoder fix to changelog
2025-03-31 10:53:52 +02:00
ivmarkov
ad305a909c Clippy 2025-03-24 09:28:01 +00:00
ivmarkov
d08f558588 Clippy for all examples 2025-03-24 08:30:55 +00:00
ivmarkov
17790a01db Fix ADC build issues on earlier released ESP-IDF 5.X; fix unexpected cfgs warnings in examples 2025-03-24 08:11:27 +00:00
lonesometraveler
80c674e0a8
Replace Arc with Rc in ledc_threads example (#514)
* Update ledc_threads.rs

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: ivmarkov <ivan.markov@gmail.com>
2025-03-13 20:35:31 +02:00
Jagoda Estera Ślązak
6c3cc56df6
feat: add DB_12 adc attenuation and deprecate DB_11 for ESP-IDF V5.0+ (#520)
* feat: add `DB_12` adc attenuation and deprecate `DB_11` for ESP-IDF V5.0+

* fix: allow usages of deprecated `DB_11` in adc.rs

* fix: in adc example, use DB_11 for ESP-IDF v4 and DB_12 for ESP-IDF v5

---------

Co-authored-by: ivmarkov <ivan.markov@gmail.com>
2025-03-13 20:27:58 +02:00
Justin Buchanan
318bb4e4fe
ledc: add support for fading leds (#519) 2025-03-13 20:26:23 +02:00
lonesometraveler
8a11ef463e
Fix RGB to u32 conversion order in rmt_neopixel example (#505)
* Update rmt_neopixel.rs

* Update rmt_neopixel.rs

* Update CHANGELOG.md
2025-01-06 16:36:44 +02:00
ivmarkov
d6f11649ae Fix CI; remove warnings from the example 2025-01-01 19:01:57 +00:00
ivmarkov
7632fc39db
Bugfix: drop calibration handle on driver drop; more control on the r… (#470)
* Bugfix: drop calibration handle on driver drop; more control on the raw-to-mv conversion

* Fix variable name

* Rename raw_to_cal to raw_to_mv to have less confusion as to what is going on

* Fix inline example

* Fix CI for the legacy driver

* Fix CI for the oneshot driver

* Fix examples in CI

* Fix wrong fn name
2024-12-22 18:40:03 +02:00
g
7d5e233ac9
Fix ReadScratch command buffer size (#494) 2024-10-21 22:42:22 +03:00
Eli Lipsitz
a0bae3035a spi: Add custom spi::Operation enum
This replaces the Operation enum which was previously re-exported from
embedded_hal.

As of this commit, the enum is identical to the embedded_hal Operation,
except that there is no Word type parameter, as esp-idf-hal only uses u8
for SPI. Additionally, the `#[non_exhaustive]` attribute has been added
to allow for future expansion.
2024-09-29 19:39:47 +02:00
GamerBene19
a619f13871
Add support for ESP internal temperature sensor (#337)
* Add first version of temp sensor driver

Code is very rudimentary and still suspect to change.
Notably, error handling is not implemented yet.

* Change cfg attribute to not any

* Rename TemperatureSensor to TemperatureSensorDriver

* Switch to `core::ptr`

* Add error handling

* Build the internal temperature sensor only on supported targets

* Fix the derives in TemperatureSensorConfig, TemperatureSensorClockSource

* Implement From<TemperatureSensorConfig> for temperature_sensor_config_t

* Use right clocks for temperature sensor depending on target

* Rename config and move it into own module

* Provide const new constructor for temperature sensor config

* Change config argument to be a reference

* Rename TemperatureSensor to TempSensor

* Avoid cloning config in temp driver constructor

* Add back derived Copy trait for TempSensorClockSource

* Add non_exhaustive option to TempSensorConfig

* Add temp sensor peripheral

* Cause panic if uninstalling the temp driver fails

* Implement Send for TempSensorDriver

* Make use of esp_idf_soc_temp_sensor_supported

* Add an example for temperature_sensor

---------

Co-authored-by: Luca Barbato <lu_zero@gentoo.org>
2024-09-09 19:46:26 +03:00
hyx0329
e20ef5c92f
Add an example of using interrupt directly without async (#474) 2024-09-09 18:16:26 +03:00
DaneSlattery
aa0e257ffe
RMT Onewire Peripheral (#454)
* commit test 1

test commit 2

next device

asd

* try example, haven't built yet

* Add feature flags for legacy RMT examples

Remove references to the ds18b20 specific device.

Add a feature flag `rmt-legacy` that, when enabled, will build the
original rmt modules from v4 of the esp-idf. When disabled, the v5
rmt interface can be used for one wire applications.

Implement the Iterator trait for a device search and use the Iterator
in the example.

* Add more feature guards to examples compile

* Add alternative main functions for examples

* Use std threading

* Add std to thread sleep

* use std duration

* correct use for legacy rmt component

* Remove local bindings and use the esp-idf-sys master

* fix a typo

* Remove esp-idf component inclusion

* Update gitignore

* Fix examples

* mut-ex out the example compilation

* add implementation for temperature readings

* Conditional compile

* esp4.4 compile

* Changes to cargo and config

* Remove OWDevice and simplify API

* Remove phantomdata that is not required

* adjust lifetimes for single search at a time

* Keep RMT peripheral and add channel to onewire

Moves the RMT driver into a private `driver` module, which will only be compiled in rmt-legacy mode.

Also reduce the number of cfg feature flags in examples by wrapping the implementation in a module.

* modularise examples

* Fix for CI

* update example name to make it pop

---------

Co-authored-by: Dane Slattery <dane@polarmonitoring.com>
Co-authored-by: DaneSlattery <dane_s@umantec.net>
2024-08-10 16:11:38 +03:00
Jorge Muñoz
74ffea5c0c
Fixes #443: Add new ResetReason enum items (#444)
* Fixes #443: Add new ResetReason enum items

* Fix examples/reset_reason.rs comments

* Add forgotten 5.1.3 version to conditions

* Add forgotten 5.1.3 version to more conditions
2024-07-02 16:17:48 +02:00
ivmarkov
f20b9f71a5 Replace with 2024-06-16 07:50:15 +00:00
ivmarkov
16823abd7d Protect the legacy example; do not make the oneshot_legacy mod an API (yet) 2024-06-16 07:35:35 +00:00
ivmarkov
e3e8a37807 Hide the new ADC oneshot driver behind a feature flag 2024-06-16 07:35:35 +00:00
adam-53-r
0360fc8d0a
Fixed one character typo. (#381) 2024-02-20 14:18:13 +00:00
David Sheets
5657073293
RMT symbols and musical buzzer example bugfix for ESP32 (#354)
* rmt: wrap rmt_item32_t in a newtype

This makes it much easier to use `TxRmtDriver::start_iter` and
`TxRmtDriver::start_iter_blocking` (#113).

* examples/rmt_musical_buzzer: fix for ESP32

Possibly broken by #97, possibly never worked. The ESP-IDF repo
specifically excludes the ESP32 from the RMT musical buzzer demo
because its RMT unit lacks hardware looping. Before this change, the
demo would simply hang when trying to play the second note possibly
because the ESP32 RMT unit does not support asynchronous stopping.

As an added bonus, this example is now much easier to modify to
experiment with 1-bit chiptune synthesis by making every symbol
(cycle) accessible in the ISR iterator.

* rmt: remove Pulse::into_rmt_item in favor of Symbol::new

Also, factor Pulse pairs into function arguments for ease of use.
2024-01-31 15:39:29 +02:00
ivmarkov
e79df5a873 Get rid of the riscv-ulp-hal feature 2024-01-18 20:12:27 +00:00
ivmarkov
05140a3056 The crate now does build with cargo --all-features 2024-01-05 16:26:26 +00:00
ivmarkov
455cf15dc6 Fix CI 2023-11-22 06:14:39 +00:00
ivmarkov
6eeeae1018 Use better pins for esp32 2023-10-16 19:27:53 +00:00
ivmarkov
bb92e2a47e Async examples 2023-10-14 07:36:30 +00:00
ivmarkov
092055b967 Bugfixing; async timer example 2023-10-09 18:55:44 +00:00
ivmarkov
ebeef0fcc8
All executors (#315)
* Support for all async executors

* Make all Notifiucation primitives a public API

* Address a small typo

* Address a small typo

* Fix CI

* Tighten the notify APIs by not taking 0s

* Fix CI

* Fix changelog

* Fix changelog

* Fix the examples

* edge-executor support moved to edge-executor

* wake-from-isr feature for edge-executor

* Fix CI

* Bugfixing

* Clippy
2023-10-06 22:01:20 +03:00
ivmarkov
4df6030eb8 fix CI 2023-09-19 08:56:21 +00:00
ivmarkov
53a48597d8 fix CI 2023-09-19 06:49:47 +00:00
ivmarkov
356f9f8218 Fix CI 2023-09-18 06:12:09 +00:00
liebman
95dfc2f9f7
Adc oneshot driver (#302)
* esp-idf v5 Adc oneshot driver

* cargo fmt

* added example & cargo fmt

* fix clippy issues

* more clippy's

* even more clippy's

* handle most review comments

* AdcChannelDriver: remove ADC annotation - use T::Adc
AdcChannelDriver: remove Sync implementation
examples: update adc_oneshot

* cargo fmt
remove AdcChannelDriver::channel

* implement e-hal 0.2 Adc OneShot trait
2023-09-18 06:59:54 +03:00
ivmarkov
d7ca04fb27 Option to notify a task without yield 2023-09-14 08:05:50 +00:00
ivmarkov
2cb816c6d4 Split the notification mechanism from the executor module 2023-09-08 17:20:00 +00:00
ivmarkov
bed45e741e
Upgrade to e-hal 1.0-rc1 (#295)
* Upgrade to e-hal 1.0-rc1

* e-hal is no longer alpha

* Fix for ESP IDF < 5

* Unite all delay impls in a single module

* Model delays between transactions

* SPI: Make queueing it a bit more readable

* SPI: Plug delays

* Shorten the threshold for the Delay provider

* Clippy

* Fix the examples

* SPI: Detect last transaction in the presence of delays

* SPI: Introduce CsPin

* SPI: Introduce CsPin

* SPI: Mark delays with TODO

* Clippy

* SPI: Rename CsPin to CsCtl

* Transfer_transaction not necessary
2023-09-06 09:36:48 +03:00
ivmarkov
8cc193aa35
TWAI driver async hack; examples cleanup (#292)
* Hacky async TWAI driver

* Async TWAI: Custom priority and pin to core

* Async TWAI: Proper configuration of alerts

* Do not refer to esp-idf-sys as it is not an explicit dependency anymore
2023-08-27 10:47:18 +03:00
ivmarkov
9fc2e8c61e
Async drivers (#279)
* Continuous mode ADC

* GPIO: Switch to the common notification; remove alloc req for async

* (WIP) async SPI

* Notification callbacks in async SPI

* SPI: Lower the code repetition

* Fix the build

* I2S pre-async simplification

* Async methods for I2S

* SPI: Wait for the transaction to complete on drop

* More flexibility in PinDriver::wait_for

* Remove the gargantuan mutex for now

* Arrays supported as ADC channels

* Fix timeouts

* ADC: measurement shape

* Fix the dependencies

* Fix CI

* ADC: cont config

* ADC: better atten API; fix delays

* ADC: Raw handle access

* I2S: Make config more symmetric with the other drivers

* I2S: Remove unnecessary generics

* Improve the semantics of read/write vrt partial r/w

* Review feedback

* Clippy

* Shorten static array initializers

* Do not glob-import all of esp-idf-sys

* SPI: make notifications non-static

* SPI: Remove the async fetch() hack; extend async support

* Fix the CI

* SPI: Restore WriteIter impl

* Bugfix: tx/rx handles mismatch

* I2S: Utility methods to write the whole buffer

* I2S Bugfix: wrong translation to native format

* More ergonomic API for TickType

* unsubscribe during reset will fail if ISR service is not enabled yet

* Typo

* Same defaults

* No need for unsafe here

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

* Assert that ESP_ERR_TIMEOUT should never happen

* Safe variant of completion

* ADC: wrong timeout conversion

* Proof of posession of i2s0/spi3 for esp32/esp32s2

* write_async only available on ESP IDF 5+

* Option to transmute the adc buffer to pcm

* ADC: only expose PCM conversion where it is possible (esp32/esp32s2)

* ADC: Fix channel chaining

* ADC: fix the CI

* ADC: Nullify everything

* ADC: as_pcm32 for riscv and esp32s3

* ADC: as_pcm32 for riscv and esp32s3

* ADC: read_raw

* I2S: Proper driver shutdown

* ADC: Fix clippy and compile errors on ESP-IDF 4

* Compat with ESP-IDF master

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2023-08-22 15:39:02 +03:00
Frederick Vollbrecht
a5dc68adcf
🚸 add simple timer example with task notify (#277)
* 🚸 add simple timer example with task notify

* use println do avoid log dev-dep

* remove esp-idf-svc dep on logging
2023-07-05 21:54:06 +03:00
Øyvind Myrstad Netland
c0534b9428
adds example for i2c between master and slave I2C on same device (#274) 2023-07-05 21:50:32 +03:00
David Cuthbert
8e0ddd7457
pconfig does not need to be mut. (#272)
This fixes a clippy issue from rust-analyzer that's been sitting in
VSCode's problems pane for a while.
2023-07-03 12:17:36 +03:00
Mikael Lund
091128a282
Refactor Rgb struct (#265)
* Refactor Rgb struct

Moves hsv convertion into
an associated function and further
implements From<Rgb> for u32.

* Update rmt_neopixel.rs

* Replace if-else with pattern matching
2023-06-22 18:31:54 +03:00
ivmarkov
ba9cc4246a Interrupt flags 2023-05-13 10:07:38 +00:00