Skip to content

Commit

Permalink
feat(buzzer): Add esp-hal-buzzer to drive a piezo-electric buzzer.
Browse files Browse the repository at this point in the history
Provides a driver for a piezo-electric buzzer by abstracting LEDC and offering a user-friendly API for a buzzer
  • Loading branch information
AnthonyGrondin committed Aug 30, 2024
1 parent 5917275 commit ad5e912
Show file tree
Hide file tree
Showing 11 changed files with 4,078 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exclude = [
"esp-backtrace",
"esp-build",
"esp-hal",
"esp-hal-buzzer",
"esp-hal-embassy",
"esp-hal-procmacros",
"esp-hal-smartled",
Expand Down
18 changes: 18 additions & 0 deletions esp-hal-buzzer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added

### Changed

### Fixed

### Removed

## 0.1.0 - 2024-08-21 - Initial release
38 changes: 38 additions & 0 deletions esp-hal-buzzer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "esp-hal-buzzer"
version = "0.1.0"
edition = "2021"
rust-version = "1.76.0"
description = "Buzzer driver for esp-hal"
repository = "https://github.com/esp-rs/esp-hal"
license = "MIT OR Apache-2.0"

[package.metadata.docs.rs]
features = ["esp32c3"]
targets = ["riscv32imc-unknown-none-elf"]

[dependencies]
defmt = { version = "0.3.8", optional = true }
document-features = "0.2.10"
esp-hal = { version = "0.19.0", path = "../esp-hal" }
fugit = "0.3.7"

[features]
## Implement `defmt::Format` on certain types.
defmt = ["dep:defmt", "esp-hal/defmt"]

#! ### Chip Support Feature Flags
## Target the ESP32.
esp32 = ["esp-hal/esp32"]
## Target the ESP32-C2.
esp32c2 = ["esp-hal/esp32c2"]
## Target the ESP32-C3.
esp32c3 = ["esp-hal/esp32c3"]
## Target the ESP32-C6.
esp32c6 = ["esp-hal/esp32c6"]
## Target the ESP32-H2.
esp32h2 = ["esp-hal/esp32h2"]
## Target the ESP32-S2.
esp32s2 = ["esp-hal/esp32s2"]
## Target the ESP32-S3.
esp32s3 = ["esp-hal/esp32s3"]
35 changes: 35 additions & 0 deletions esp-hal-buzzer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# esp-hal-buzzer

[![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)
[![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)
![MSRV](https://img.shields.io/badge/MSRV-1.76-blue?labelColor=1C2C2E&style=flat-square)
![Crates.io](https://img.shields.io/crates/l/esp-hal-buzzer?labelColor=1C2C2E&style=flat-square)
[![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)

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.

A few songs are included in the [songs](./src/songs.rs) module. Contributions are welcome.

## [Documentation]

[documentation]: https://docs.rs/esp-hal-buzzer/

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.76 and up. It _might_
compile with older versions but that may change in any new patch release.

## License

Licensed under either of:

- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
any additional terms or conditions.
Loading

0 comments on commit ad5e912

Please sign in to comment.