Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ws2812/others.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !digispark && !arduino && !arduino_uno && !xiao_esp32c3
//go:build !digispark && !arduino && !arduino_uno && !xiao_esp32c3 && !teensy36

package main

Expand Down
10 changes: 10 additions & 0 deletions examples/ws2812/teensy36.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build teensy36

package main

import "machine"

func init() {
// The Teensy 3.6 has no onboard LEDs, so drive an external strip.
neo = machine.D02
}
1 change: 1 addition & 0 deletions smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ tinygo build -size short -o ./build/test.hex -target=feather-nrf52840 ./examples
tinygo build -size short -o ./build/test.hex -target=arduino ./examples/ws2812
tinygo build -size short -o ./build/test.hex -target=digispark ./examples/ws2812
tinygo build -size short -o ./build/test.bin -target=xiao-esp32c3 ./examples/ws2812
tinygo build -size short -o ./build/test.hex -target=teensy36 ./examples/ws2812
tinygo build -size short -o ./build/test.hex -target=arduino ./examples/ws2812/neopixel-shield
tinygo build -size short -o ./build/test.hex -target=arduino-zero ./examples/ws2812/neopixel-shield
tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bme280/main.go
Expand Down
2 changes: 1 addition & 1 deletion ws2812/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
// On RP2040/RP2350 it uses PIO for hardware-timed control.
package ws2812 // import "tinygo.org/x/drivers/ws2812"

//go:generate go run gen-ws2812.go -arch=cortexm 16 48 64 120 125 150 160 168 200
//go:generate go run gen-ws2812.go -arch=cortexm 16 48 64 120 125 150 160 168 180 200
//go:generate go run gen-ws2812.go -arch=tinygoriscv 320
//go:generate go run gen-ws2812.go -arch=esp32c3 160
8 changes: 6 additions & 2 deletions ws2812/gen-ws2812.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,12 @@ func writeGoWrapper(f *os.File, arch string, megahertz int) error {
buf := &bytes.Buffer{}
fmt.Fprintf(buf, "\n")
fmt.Fprintf(buf, "func (d Device) writeByte%d(c byte) {\n", megahertz)
fmt.Fprintf(buf, " portSet, maskSet := d.Pin.PortMaskSet()\n")
fmt.Fprintf(buf, " portClear, maskClear := d.Pin.PortMaskClear()\n")
if arch == "cortexm" {
fmt.Fprintf(buf, " portSet, maskSet, portClear, maskClear := d.portMasks()\n")
} else {
fmt.Fprintf(buf, " portSet, maskSet := d.Pin.PortMaskSet()\n")
fmt.Fprintf(buf, " portClear, maskClear := d.Pin.PortMaskClear()\n")
}
fmt.Fprintf(buf, "\n")
fmt.Fprintf(buf, " mask := interrupt.Disable()\n")
fmt.Fprintf(buf, " C.ws2812_writeByte%d(C.char(c), (*C.uint32_t)(unsafe.Pointer(portSet)), (*C.uint32_t)(unsafe.Pointer(portClear)), C.uint32_t(maskSet), C.uint32_t(maskClear))\n", megahertz)
Expand Down
Loading
Loading