inline documentation

This commit is contained in:
Máximo Cuadros
2016-11-13 18:21:03 +01:00
parent 0f2b167746
commit df4ffb58f4
5 changed files with 33 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
"image/color"
"github.com/mcuadros/go-rpi-rgb-led-matrix"
@@ -9,6 +10,7 @@ import (
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
)
@@ -16,6 +18,7 @@ var (
func main() {
config := &rgbmatrix.DefaultConfig
config.Rows = *rows
config.Parallel = *parallel
config.ChainLength = *chain
config.Brightness = *brightness
@@ -28,6 +31,7 @@ func main() {
bounds := c.Bounds()
for x := bounds.Min.X; x < bounds.Max.X; x++ {
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
fmt.Println("x", x, "y", y)
c.Set(x, y, color.RGBA{255, 0, 0, 255})
c.Render()
}

View File

@@ -2,6 +2,7 @@ package main
import (
"flag"
"image"
"os"
"time"
@@ -11,18 +12,21 @@ import (
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
image = flag.String("image", "", "image path")
rotate = flag.Int("rotate", 0, "rotate angle, 90, 180, 270")
img = flag.String("image", "", "image path")
rotate = flag.Int("rotate", 0, "rotate angle, 90, 180, 270")
)
func main() {
f, err := os.Open(*image)
f, err := os.Open(*img)
fatal(err)
config := &rgbmatrix.DefaultConfig
config.Rows = *rows
config.Parallel = *parallel
config.ChainLength = *chain
config.Brightness = *brightness

View File

@@ -10,6 +10,7 @@ import (
var (
rows = flag.Int("led-rows", 32, "number of rows supported")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
)
@@ -18,6 +19,7 @@ func main() {
config.Rows = *rows
config.ChainLength = *chain
config.Brightness = *brightness
config.Parallel = *parallel
m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err)