Skip to content

Commit 1a6c76e

Browse files
feat(buzzer): Add esp-hal-buzzer to drive a piezo-electric buzzer.
Provides a driver for a piezo-electric buzzer by abstracting LEDC and offering a user-friendly API for a buzzer
1 parent f829c8f commit 1a6c76e

File tree

11 files changed

+4078
-6
lines changed

11 files changed

+4078
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ exclude = [
66
"esp-backtrace",
77
"esp-build",
88
"esp-hal",
9+
"esp-hal-buzzer",
910
"esp-hal-embassy",
1011
"esp-hal-procmacros",
1112
"esp-hal-smartled",

esp-hal-buzzer/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
### Added
11+
12+
### Changed
13+
14+
### Fixed
15+
16+
### Removed
17+
18+
## 0.1.0 - 2024-08-21 - Initial release

esp-hal-buzzer/Cargo.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[package]
2+
name = "esp-hal-buzzer"
3+
version = "0.1.0"
4+
edition = "2021"
5+
rust-version = "1.76.0"
6+
description = "Buzzer driver for esp-hal"
7+
repository = "https://github.com/esp-rs/esp-hal"
8+
license = "MIT OR Apache-2.0"
9+
10+
[package.metadata.docs.rs]
11+
features = ["esp32c3"]
12+
targets = ["riscv32imc-unknown-none-elf"]
13+
14+
[dependencies]
15+
defmt = { version = "0.3.8", optional = true }
16+
document-features = "0.2.10"
17+
esp-hal = { version = "0.19.0", path = "../esp-hal" }
18+
fugit = "0.3.7"
19+
20+
[features]
21+
## Implement `defmt::Format` on certain types.
22+
defmt = ["dep:defmt", "esp-hal/defmt"]
23+
24+
#! ### Chip Support Feature Flags
25+
## Target the ESP32.
26+
esp32 = ["esp-hal/esp32"]
27+
## Target the ESP32-C2.
28+
esp32c2 = ["esp-hal/esp32c2"]
29+
## Target the ESP32-C3.
30+
esp32c3 = ["esp-hal/esp32c3"]
31+
## Target the ESP32-C6.
32+
esp32c6 = ["esp-hal/esp32c6"]
33+
## Target the ESP32-H2.
34+
esp32h2 = ["esp-hal/esp32h2"]
35+
## Target the ESP32-S2.
36+
esp32s2 = ["esp-hal/esp32s2"]
37+
## Target the ESP32-S3.
38+
esp32s3 = ["esp-hal/esp32s3"]

esp-hal-buzzer/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# esp-hal-buzzer
2+
3+
[![Crates.io](https://img.shields.io/crates/v/esp-hal-buzzer?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/esp-hal-buzzer)
4+
[![docs.rs](https://img.shields.io/docsrs/esp-hal-buzzer?labelColor=1C2C2E&color=C96329&logo=rust&style=flat-square)](https://docs.rs/esp-hal-buzzer)
5+
![MSRV](https://img.shields.io/badge/MSRV-1.76-blue?labelColor=1C2C2E&style=flat-square)
6+
![Crates.io](https://img.shields.io/crates/l/esp-hal-buzzer?labelColor=1C2C2E&style=flat-square)
7+
[![Matrix](https://img.shields.io/matrix/esp-rs:matrix.org?label=join%20matrix&labelColor=1C2C2E&color=BEC5C9&logo=matrix&style=flat-square)](https://matrix.to/#/#esp-rs:matrix.org)
8+
9+
Provides a driver to easily interact with piezo-electric buzzers for `esp-hal`. The crate uses the underlying Ledc driver and provides a user-friendly API.
10+
11+
A few songs are included in the [songs](./src/songs.rs) module. Contributions are welcome.
12+
13+
## [Documentation]
14+
15+
[documentation]: https://docs.rs/esp-hal-buzzer/
16+
17+
## Minimum Supported Rust Version (MSRV)
18+
19+
This crate is guaranteed to compile on stable Rust 1.76 and up. It _might_
20+
compile with older versions but that may change in any new patch release.
21+
22+
## License
23+
24+
Licensed under either of:
25+
26+
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
27+
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
28+
29+
at your option.
30+
31+
### Contribution
32+
33+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
34+
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
35+
any additional terms or conditions.

0 commit comments

Comments
 (0)