mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
1d695a231a
This adds support to the WS2812 for the ESP32-C3 processor which is a RISC-V processor from Espressif. Signed-off-by: deadprogram <ron@hybridgroup.com>
17 lines
316 B
Go
17 lines
316 B
Go
//go:build tinygo.riscv32 && !esp32c3
|
|
|
|
package ws2812
|
|
|
|
import "machine"
|
|
|
|
// Send a single byte using the WS2812 protocol.
|
|
func (d Device) WriteByte(c byte) error {
|
|
switch machine.CPUFrequency() {
|
|
case 320_000_000: // 320MHz, e.g. fe310
|
|
d.writeByte320(c)
|
|
return nil
|
|
default:
|
|
return errUnknownClockSpeed
|
|
}
|
|
}
|