Add cli options to examples

pull/11/head
Mike Ryan 7 years ago
parent c5664a111c
commit 2843f6de38

@ -11,18 +11,28 @@ import (
) )
var ( var (
rows = flag.Int("led-rows", 32, "number of rows supported") rows = flag.Int("led-rows", 32, "number of rows supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels") cols = flag.Int("led-cols", 32, "number of columns 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)") chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
show_refresh = flag.Bool("led-show-refresh", false, "Show refresh rate.")
inverse_colors = flag.Bool("led-inverse", false, "Switch if your matrix has inverse colors on.")
disable_hardware_pulsing = flag.Bool("led-no-hardware-pulse", false, "Don't use hardware pin-pulse generation.")
) )
func main() { func main() {
config := &rgbmatrix.DefaultConfig config := &rgbmatrix.DefaultConfig
config.Rows = *rows config.Rows = *rows
config.Cols = *cols
config.Parallel = *parallel config.Parallel = *parallel
config.ChainLength = *chain config.ChainLength = *chain
config.Brightness = *brightness config.Brightness = *brightness
config.HardwareMapping = *hardware_mapping
config.ShowRefreshRate = *show_refresh
config.InverseColors = *inverse_colors
config.DisableHardwarePulsing = *disable_hardware_pulsing
m, err := rgbmatrix.NewRGBLedMatrix(config) m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err) fatal(err)

@ -9,18 +9,28 @@ import (
) )
var ( var (
rows = flag.Int("led-rows", 32, "number of rows supported") rows = flag.Int("led-rows", 32, "number of rows supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels") cols = flag.Int("led-cols", 32, "number of columns 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)") chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
show_refresh = flag.Bool("led-show-refresh", false, "Show refresh rate.")
inverse_colors = flag.Bool("led-inverse", false, "Switch if your matrix has inverse colors on.")
disable_hardware_pulsing = flag.Bool("led-no-hardware-pulse", false, "Don't use hardware pin-pulse generation.")
) )
func main() { func main() {
config := &rgbmatrix.DefaultConfig config := &rgbmatrix.DefaultConfig
config.Rows = *rows config.Rows = *rows
config.Cols = *cols
config.Parallel = *parallel config.Parallel = *parallel
config.ChainLength = *chain config.ChainLength = *chain
config.Brightness = *brightness config.Brightness = *brightness
config.HardwareMapping = *hardware_mapping
config.ShowRefreshRate = *show_refresh
config.InverseColors = *inverse_colors
config.DisableHardwarePulsing = *disable_hardware_pulsing
m, err := rgbmatrix.NewRGBLedMatrix(config) m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err) fatal(err)

@ -10,11 +10,16 @@ import (
) )
var ( var (
rows = flag.Int("led-rows", 32, "number of rows supported") rows = flag.Int("led-rows", 32, "number of rows supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels") cols = flag.Int("led-cols", 32, "number of columns 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)") chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
img = flag.String("image", "", "image path") brightness = flag.Int("brightness", 100, "brightness (0-100)")
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
show_refresh = flag.Bool("led-show-refresh", false, "Show refresh rate.")
inverse_colors = flag.Bool("led-inverse", false, "Switch if your matrix has inverse colors on.")
disable_hardware_pulsing = flag.Bool("led-no-hardware-pulse", false, "Don't use hardware pin-pulse generation.")
img = flag.String("image", "", "image path")
rotate = flag.Int("rotate", 0, "rotate angle, 90, 180, 270") rotate = flag.Int("rotate", 0, "rotate angle, 90, 180, 270")
) )
@ -25,9 +30,14 @@ func main() {
config := &rgbmatrix.DefaultConfig config := &rgbmatrix.DefaultConfig
config.Rows = *rows config.Rows = *rows
config.Cols = *cols
config.Parallel = *parallel config.Parallel = *parallel
config.ChainLength = *chain config.ChainLength = *chain
config.Brightness = *brightness config.Brightness = *brightness
config.HardwareMapping = *hardware_mapping
config.ShowRefreshRate = *show_refresh
config.InverseColors = *inverse_colors
config.DisableHardwarePulsing = *disable_hardware_pulsing
m, err := rgbmatrix.NewRGBLedMatrix(config) m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err) fatal(err)

@ -8,18 +8,28 @@ import (
) )
var ( var (
rows = flag.Int("led-rows", 32, "number of rows supported") rows = flag.Int("led-rows", 32, "number of rows supported")
chain = flag.Int("led-chain", 2, "number of displays daisy-chained") cols = flag.Int("led-cols", 32, "number of columns supported")
parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels") parallel = flag.Int("led-parallel", 1, "number of daisy-chained panels")
brightness = flag.Int("brightness", 100, "brightness (0-100)") chain = flag.Int("led-chain", 2, "number of displays daisy-chained")
brightness = flag.Int("brightness", 100, "brightness (0-100)")
hardware_mapping = flag.String("led-gpio-mapping", "regular", "Name of GPIO mapping used.")
show_refresh = flag.Bool("led-show-refresh", false, "Show refresh rate.")
inverse_colors = flag.Bool("led-inverse", false, "Switch if your matrix has inverse colors on.")
disable_hardware_pulsing = flag.Bool("led-no-hardware-pulse", false, "Don't use hardware pin-pulse generation.")
) )
func main() { func main() {
config := &rgbmatrix.DefaultConfig config := &rgbmatrix.DefaultConfig
config.Rows = *rows config.Rows = *rows
config.Cols = *cols
config.Parallel = *parallel
config.ChainLength = *chain config.ChainLength = *chain
config.Brightness = *brightness config.Brightness = *brightness
config.Parallel = *parallel config.HardwareMapping = *hardware_mapping
config.ShowRefreshRate = *show_refresh
config.InverseColors = *inverse_colors
config.DisableHardwarePulsing = *disable_hardware_pulsing
m, err := rgbmatrix.NewRGBLedMatrix(config) m, err := rgbmatrix.NewRGBLedMatrix(config)
fatal(err) fatal(err)

Loading…
Cancel
Save