tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
617 stars 195 forks source link

buzzer: add pwm version buzzer #372

Closed sago35 closed 2 years ago

sago35 commented 2 years ago

In this PR, the PWM version buzzer will be added.

The difference in sound when using Wio Terminal is as follows. https://twitter.com/sago35tk/status/1488848571533500416?s=20&t=aN3Y_Qsd0aHKMxuwVQn-Vg

sago35 commented 2 years ago

Make it depend on PWM interface instead of machine.TCC. The machine.TCC is probably only present in samd.

deadprogram commented 2 years ago

Small change, perhaps better to name the example here buzzer-pwm instead of buzzer2? Seems more meaningful.

sago35 commented 2 years ago

@deadprogram You are right. If the review is OK, squash merge when you merge. Please let me know if you have any other remarks.

aykevl commented 2 years ago

We already have something very similar to this, the tone driver. How is this different?

sago35 commented 2 years ago

Oops, I didn't know there was such a thing as a tone driver.

sago35 commented 2 years ago

I modified the source code so that CI would succeed. However, this PR is unnecessary and can be closed.