machine/samd51: add DAC support (#1198)

* machine/samd51: add DAC support
This commit is contained in:
sago35
2020-07-06 21:02:51 +09:00
committed by GitHub
parent e0b9b1ecd1
commit 1a6bed3305
6 changed files with 87 additions and 8 deletions
+13
View File
@@ -0,0 +1,13 @@
// +build circuitplay_express
package main
import (
"machine"
)
func init() {
enable := machine.PA30
enable.Configure(machine.PinConfig{Mode: machine.PinOutput})
enable.Set(true)
}
+1 -5
View File
@@ -10,16 +10,12 @@ import (
)
func main() {
enable := machine.PA30
enable.Configure(machine.PinConfig{Mode: machine.PinOutput})
enable.Set(true)
speaker := machine.A0
speaker.Configure(machine.PinConfig{Mode: machine.PinOutput})
machine.DAC0.Configure(machine.DACConfig{})
data := []uint16{32768, 8192, 2048, 512, 0}
data := []uint16{0xFFFF, 0x8000, 0x4000, 0x2000, 0x1000, 0x0000}
for {
for _, val := range data {
+13
View File
@@ -0,0 +1,13 @@
// +build pyportal
package main
import (
"machine"
)
func init() {
enable := machine.SPK_SD
enable.Configure(machine.PinConfig{Mode: machine.PinOutput})
enable.Set(true)
}