From 2843f6de381ed140ca8ad04f79e4dc6d4e58e5cb Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Mon, 5 Mar 2018 11:28:39 -0600 Subject: [PATCH] Add cli options to examples --- examples/animation/main.go | 18 ++++++++++++++---- examples/basic/main.go | 18 ++++++++++++++---- examples/image/main.go | 20 +++++++++++++++----- examples/rpc/server/main.go | 20 +++++++++++++++----- 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/examples/animation/main.go b/examples/animation/main.go index 66a9ae4..c9d69ed 100644 --- a/examples/animation/main.go +++ b/examples/animation/main.go @@ -11,18 +11,28 @@ 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)") + rows = flag.Int("led-rows", 32, "number of rows supported") + cols = flag.Int("led-cols", 32, "number of columns 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)") + 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() { config := &rgbmatrix.DefaultConfig config.Rows = *rows + config.Cols = *cols config.Parallel = *parallel config.ChainLength = *chain 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) fatal(err) diff --git a/examples/basic/main.go b/examples/basic/main.go index d04cb9c..fe5b3ee 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -9,18 +9,28 @@ 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)") + rows = flag.Int("led-rows", 32, "number of rows supported") + cols = flag.Int("led-cols", 32, "number of columns 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)") + 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() { config := &rgbmatrix.DefaultConfig config.Rows = *rows + config.Cols = *cols config.Parallel = *parallel config.ChainLength = *chain 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) fatal(err) diff --git a/examples/image/main.go b/examples/image/main.go index c8aeec9..95ec382 100644 --- a/examples/image/main.go +++ b/examples/image/main.go @@ -10,11 +10,16 @@ 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)") - img = flag.String("image", "", "image path") + rows = flag.Int("led-rows", 32, "number of rows supported") + cols = flag.Int("led-cols", 32, "number of columns 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)") + 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") ) @@ -25,9 +30,14 @@ func main() { config := &rgbmatrix.DefaultConfig config.Rows = *rows + config.Cols = *cols config.Parallel = *parallel config.ChainLength = *chain 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) fatal(err) diff --git a/examples/rpc/server/main.go b/examples/rpc/server/main.go index 7e634b2..7b9a232 100644 --- a/examples/rpc/server/main.go +++ b/examples/rpc/server/main.go @@ -8,18 +8,28 @@ 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)") + rows = flag.Int("led-rows", 32, "number of rows supported") + cols = flag.Int("led-cols", 32, "number of columns 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)") + 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() { config := &rgbmatrix.DefaultConfig config.Rows = *rows + config.Cols = *cols + config.Parallel = *parallel config.ChainLength = *chain 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) fatal(err)