clean commit, added smoke tests

This commit is contained in:
Daniel Esteban
2019-04-30 12:57:13 +02:00
committed by Ron Evans
parent de22b8839e
commit 35a7590c2d
7 changed files with 315 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
package main
import (
"image/color"
"machine"
"time"
"github.com/tinygo-org/drivers/pcd8544"
)
func main() {
dcPin := machine.GPIO{machine.P3}
dcPin.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
rstPin := machine.GPIO{machine.P4}
rstPin.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
scePin := machine.GPIO{machine.P5}
scePin.Configure(machine.GPIOConfig{Mode: machine.GPIO_OUTPUT})
machine.SPI0.Configure(machine.SPIConfig{})
lcd := pcd8544.New(machine.SPI0, dcPin, rstPin, scePin)
lcd.Configure(pcd8544.Config{})
var x int16
var y int16
deltaX := int16(1)
deltaY := int16(1)
for {
pixel := lcd.GetPixel(x, y)
c := color.RGBA{255, 255, 255, 255}
if pixel {
c = color.RGBA{0, 0, 0, 255}
}
lcd.SetPixel(x, y, c)
lcd.Display()
x += deltaX
y += deltaY
if x == 0 || x == 83 {
deltaX = -deltaX
}
if y == 0 || y == 47 {
deltaY = -deltaY
}
time.Sleep(1 * time.Millisecond)
}
}