def bootstrap(self): self.args = self.parser.parse_args() options = RGBMatrixOptions() if self.args.gpio_mapping != None: options.hardware_mapping = self.args.gpio_mapping options.rows = self.args.rows options.cols = self.args.cols options.chain_length = self.args.chain options.parallel = self.args.parallel options.brightness = self.args.brightness options.led_rgb_sequence = self.args.sequence if self.args.slow_write != None: options.gpio_slowdown = self.args.slow_write self.matrix = RGBMatrix(options = options) try: # run loop print("CTRL-C to stop") self.run() except KeyboardInterrupt: print("Exiting...\n") sys.exit(0) return True
def setupDisplay(): options = RGBMatrixOptions() options.rows = 16 options.cols = 32 options.brightness = 100 display = RGBMatrix(options=options) return display
def cli(ctx, verbose, home, rows, chain_length, parallel, brightness, gpio_slowdown, pwm_lsb_nanoseconds, scan_mode, hardware_mapping): """Blinky Matrix Display Driver""" ctx.verbose = verbose if home is not None: ctx.home = home # Configuration for the matrix options = RGBMatrixOptions() options.rows = rows ctx.vlog(click.style(f"rows = {options.rows}", fg="yellow")) options.chain_length = chain_length ctx.vlog(click.style(f"chain_length = {options.chain_length}", fg="yellow")) options.parallel = parallel ctx.vlog(click.style(f"parallel = {options.parallel}", fg="yellow")) options.brightness = brightness ctx.vlog(click.style(f"brightness = {options.brightness}", fg="yellow")) options.gpio_slowdown = gpio_slowdown ctx.vlog(click.style(f"gpio_slowdown = {options.gpio_slowdown}", fg="yellow")) options.pwm_lsb_nanoseconds = pwm_lsb_nanoseconds ctx.vlog(click.style(f"pwm_lsb_nanoseconds = {options.pwm_lsb_nanoseconds}", fg="yellow")) options.scan_mode = scan_mode ctx.vlog(click.style(f"scan_mode = {options.scan_mode}", fg="yellow")) options.hardware_mapping = hardware_mapping ctx.vlog(click.style(f"hardware_mapping = {options.hardware_mapping}", fg="yellow")) ctx.matrix = RGBMatrix(options = options) ctx.vlog(click.style(f"home = {ctx.home}", fg="yellow"))
def __init__(self, cols: int, rows: int, **kwargs): options = RGBMatrixOptions() options.cols = cols options.rows = rows for k, v in kwargs.items(): setattr(options, k, v) self.matrix = RGBMatrix(options=options) self.canvas = self.matrix.CreateFrameCanvas()
def __init__(self, dir="./"): self.dir = dir options = RGBMatrixOptions() options.rows = 32 options.cols = 64 options.gpio_slowdown = 2 self.matrix = RGBMatrix(options=options) self.offscreen_canvas = self.matrix.CreateFrameCanvas()
def display_image(image_file): print("hi") image = Image.open(image_file) # Configuration for the matrix options = RGBMatrixOptions() options.rows = 32 options.cols = 64 options.chain_length = 1 options.parallel = 1 options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat' options.brightness = 100 options.show_refresh_rate = 1 matrix = RGBMatrix(options=options) # Make image fit our screen. image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) matrix.SetImage(image.convert('RGB')) try: print("Press CTRL-C to stop.") while True: time.sleep(100) except KeyboardInterrupt: sys.exit(0)
def __init__(self, *args, **kwargs): o = RGBMatrixOptions() o.rows = 16 o.cols = 32 o.chain_length = 3 o.parallel = 3 o.multiplexing = 8 o.row_address_type = 0 o.pwm_lsb_nanoseconds = 100 o.brightness = 25 self.matrix = RGBMatrix(options=o)
def start(self): options = RGBMatrixOptions() options.rows = 16 options.cols = 32 #options.show_refresh_rate = 1 self.matrix = RGBMatrix(options=options) try: # Start loop print("Press CTRL-C to stop sample") offscreen_canvas = self.matrix.CreateFrameCanvas() font = graphics.Font() font.LoadFont("./6x13B.bdf") textColor = graphics.Color(0, 0, 0) xpos = 1 ypos = 14 brightness = 1 while True: # only update at 0 seconds time_now = datetime.datetime.now() time_pause = int(time_now.strftime("%-S")) if time_pause == 0: # different brightness at different times hour_of_day = int(time_now.strftime("%-H")) if hour_of_day < 7: brightness = 1 elif hour_of_day > 9: brightness = 1 else: brightness = 4 # draw a background for y in range(0, self.matrix.height): graphics.DrawLine(self.matrix, 0, y, 31, y, self.color(y, brightness)) # type time time_string = time_now.strftime("%H:%M") graphics.DrawText(self.matrix, font, xpos, ypos, textColor, time_string) time.sleep(1) except KeyboardInterrupt: print("Exiting\n") sys.exit(0)
def __init__(self): options = RGBMatrixOptions() # TODO MOVE TO CONFIG FILE options.hardware_mapping = "adafruit-hat" options.disable_hardware_pulsing = True options.rows = 16 options.cols = 32 # set default brightess to 50% to protect against power spike at turn on options.brightness = 50 options.chain_length = 4 options.pixel_mapper_config = "U-mapper" options.multiplexing = 8 # CORRECT value for 1/4 SCAN PANELS self.matrix = RGBMatrix(options=options) self.offscreen_canvas = self.matrix.CreateFrameCanvas()
def screen_init(): # Configuration for the matrix options = RGBMatrixOptions() options.rows = 32 options.cols = 64 options.chain_length = 1 options.parallel = 1 options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat' options.brightness = 100 options.show_refresh_rate = 1 global matrix matrix = RGBMatrix(options=options)
def __generateMatrixOptions(self): from rgbmatrix import RGBMatrixOptions options = RGBMatrixOptions() options.rows = 32 options.chain_length = 1 options.parallel = 1 options.hardware_mapping = 'regular' options.pwm_lsb_nanoseconds = 160 options.brightness = 80 options.drop_privileges = False return options
def process(self): options = RGBMatrixOptions() options.gpio_slowdown = 4 options.disable_hardware_pulsing = True options.hardware_mapping = "classic-pi1" self.matrix = RGBMatrix(options = options) try: # Start loop print("Press CTRL-C to stop sample") self.run() except KeyboardInterrupt: print("Exiting\n") sys.exit(0) return True
def __init__(self, chain=4, bright=50): #デフォルト設定(引数なしの場合) #Options self.options = RGBMatrixOptions() self.options.rows = 32 self.options.chain_length = chain self.options.parallel = 1 self.options.hardware_mapping = 'adafruit-hat-pwm' self.options.brightness = bright self.options.show_refresh_rate = 0 self.matrix = RGBMatrix(options=self.options) self.canvas = self.matrix.CreateFrameCanvas() # 時計用フォント読み込み self.clcfont = graphics.Font() self.clcfont.LoadFont("Resources/Metroclock.bdf") #LED長さ self._width = self.canvas.width self._height = self.canvas.height #Colors self.orange = graphics.Color(255, 110, 0) self.blue = graphics.Color(0, 220, 255) self.white = graphics.Color(255, 255, 255) self.red = graphics.Color(255, 0, 0) self.green = graphics.Color(0, 255, 0) #ループ制御用変数 self.stopper = False
class Display(): options = RGBMatrixOptions() options.rows = 32 options.cols = 64 options.parallel = 1 options.hardware_mapping = 'adafruit-hat' options.brightness = 50 options.gpio_slowdown = 4 matrix = RGBMatrix(options = options) def __init__(self): self.screen_size = const.screen_size self.image = Image.new("RGB", self.screen_size) self.t = {'first': '00', 'second': '00'} def update_screen(self, text): self.clear_screen() self.generate_text(self.image, text, const.initial_text_location, const.font_size) self.matrix.SetImage(self.image.convert('RGB')) def clear_screen(self): self.image = Image.new("RGB",self.screen_size) def update_text(self): text = self.t['first'] + ':' + self.t['second'] return text def generate_text(self, im, text, begin_loc, font_size): font = ImageFont.truetype('./fonts/digital-7-mono.ttf', size=(font_size)) draw = ImageDraw.Draw(im) draw.text(begin_loc, text, font=font, fill='red')
def __init__(self, chain=4, bright=30): # デフォルト設定(引数なしの場合) # Options self.options = RGBMatrixOptions() self.options.rows = 32 self.options.chain_length = chain self.options.parallel = 1 self.options.hardware_mapping = 'adafruit-hat-pwm' self.options.brightness = bright self.options.show_refresh_rate = 0 self.options.disable_hardware_pulsing = 0 # ラズパイ判別 model = subprocess.run(["cat", "/proc/device-tree/model"], encoding='utf-8', stdout=subprocess.PIPE) # Pi4の場合, SetImageのunsafeを有効, gpio速度低下 if "Raspberry Pi 4" in model.stdout: self.__unsafe = False self.options.gpio_slowdown = 2 else: self.__unsafe = True self.matrix = RGBMatrix(options=self.options) self.canvas = self.matrix.CreateFrameCanvas() # テキスト用フォント self.gothic = graphics.Font() self.gothic.LoadFont("Resources/Gothic-16.bdf") # color self.white = graphics.Color(255, 255, 255) # LED長さ self._width = self.canvas.width self._height = self.canvas.height
def __init__(self): options = RGBMatrixOptions() # TODO MOVE TO CONFIG FILE options.hardware_mapping = "adafruit-hat" options.disable_hardware_pulsing = True options.rows = 16 options.cols = 32 options.chain_length = 4 options.pixel_mapper_config = "U-mapper" options.multiplexing = 8 # CORRECT value for 1/4 SCAN PANELS self.matrix = RGBMatrix(options=options) self.offscreen_canvas = self.matrix.CreateFrameCanvas()
def __init__(self, *args, **kwargs): options = RGBMatrixOptions() options.hardware_mapping = "adafruit-hat" options.rows = 32 options.cols = 64 self.matrix = RGBMatrix(options=options) try: print("Press CTRL-C to stop sample") self.run() except KeyboardInterrupt: print("Exiting\n") sys.exit(0) return True
def matrix_factory(width): if not IS_PRODUCTION: return MockMatrix() options = RGBMatrixOptions() # `pwm` requires small hardware mod but greatly improves flicker options.hardware_mapping = "adafruit-hat-pwm" options.chain_length = 1 options.rows = width # these settings work well on a zero wh options.gpio_slowdown = 0 options.pwm_lsb_nanoseconds = 100 options.pwm_dither_bits = 1 options.brightness = 35 options.pixel_mapper_config = "Rotate:90" matrix = RGBMatrix(options=options) return matrix
def init(): # Configuration for the matrix options = RGBMatrixOptions() options.rows = 64 options.cols = 64 options.chain_length = 1 options.parallel = 1 options.hardware_mapping = 'regular' options.brightness = 10 return RGBMatrix(options=options)
def __init__(self, panel_rows, panel_columns, num_horiz_panels, num_vert_panels): self.total_rows = panel_rows * num_vert_panels self.total_columns = panel_columns * num_horiz_panels options = RGBMatrixOptions() options.rows = matrix_rows options.cols = matrix_columns options.chain_length = num_horiz_panels options.parallel = num_vert_panels options.hardware_mapping = 'regular' #options.gpio_slowdown = 2 self.matrix = RGBMatrix(options=options) self.background = None self.icons = [] self.screen = Image.new("RGB", (self.total_columns, self.total_rows)) self.draw = ImageDraw.Draw(self.screen) # default frequency bin params: one pixel bins, no averaging, mono-color self.num_pixels_per_freq_bin = 3 self.num_freq_bins = self.total_columns / self.num_pixels_per_freq_bin self.freq_display_style = "instant" self.set_color_palette() self.color = 150 self.y_spread = 0
def __init__(self): # Configuration for the matrix options = RGBMatrixOptions() options.cols = self.cols options.rows = self.width options.chain_length = 1 options.parallel = 1 options.gpio_slowdown = 2 options.hardware_mapping = 'adafruit-hat' options.pwm_lsb_nanoseconds = 250 self.matrix = RGBMatrix(options = options) self.offscreen_canvas = self.matrix.CreateFrameCanvas() print("init done")
def __init__(self): self.options = RGBMatrixOptions() self.options.rows = 16 self.options.chain_length = 1 self.options.parallel = 1 self.options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat' self.font = graphics.Font() self.font.LoadFont("rpi-rgb-led-matrix/fonts/5x8.bdf") self.textColor = graphics.Color(255, 0, 0)
def __init__(self): ''' ''' opts = RGBMatrixOptions() opts.gpio_slowdown = 4 opts.disable_hardware_pulsing = True opts.rows = ROWS opts.cols = COLS opts.chain_length = N_PANELS #number of panels connected opts.hardware_mapping = 'adafruit-hat' # or 'regular' self.matrix = RGBMatrix(options = opts) self.image = Image.new('RGB', (self.WIDTH, self.HEIGHT), "black") self.draw = ImageDraw.Draw(self.image) self.n = 0 self.options = {} self.options['calculate_refresh_rate'] = False self.options['virtual_LED'] = False #option 1) A solid background self.options['solid_background'] = False self.options['bg_color'] = (0, 5, 0) #option 2) A single bar moving around in the background self.options['moving_back_bar'] = False #option 3) A grated background with multiple vertical bars moving in the background self.options['grated_background'] = True #Some settings for options 2 and 3 self.options['bar_width'] = 10 self.options['grating_color'] = (5, 0, 0) self.options['bg_speed'] = 5 #option 4) Two flashing bars at an angle from buridan self.options['flashing_bars'] = False self.options['flashing_bars_positions'] = (60, 315) #The only foreground option for the moment, two buridan facing bars self.options['draw_buridan'] = True self.options['fg_color'] = (200, 0, 0) self.options['buridan_position'] = 25 #these are used to calculate refresh rate self.rt = 0 self._lastpaint = 0 #Create, daemonize, and start thread thread = threading.Thread(target=self.run, args=()) thread.daemon = True thread.start()
def init_matrix(): options = RGBMatrixOptions() options.rows = 32 options.chain_length = 4 options.pwm_bits = 3 options.pwm_lsb_nanoseconds = 300 options.gpio_slowdown = 2 return RGBMatrix(options=options)
def make_matrix(width, height, brightness): options = RGBMatrixOptions() options.gpio_slowdown = 2 options.disable_hardware_pulsing = True options.brightness = brightness options.rows = height options.cols = width return RGBMatrix(options = options)
def __init__(self): """ setup the rgb matrix; these options will be static for the demo """ options = RGBMatrixOptions() options.rows = 16 options.chain_length = 3 options.parallel = 1 options.pwm_bits = 11 options.brightness = 50 options.pwm_lsb_nanoseconds = 130 options.led_rgb_sequence = 'RGB' self.matrix = RGBMatrix(options=options)
def __init__(self, dimmer): #def __init__(self, weather, dimmer): threading.Thread.__init__(self) self.setDaemon(True) # Options options = RGBMatrixOptions() options.pwm_lsb_nanoseconds = 400 options.rows = 32 options.cols = 64 #self._weather = weather self._dimmer = dimmer # Configure LED matrix driver #self._matrix = RGBMatrix(32, 2, 1) self._matrix = RGBMatrix(options=options) self._matrix.pwmBits = 11 self._matrix.brightness = 20 # Load fonts self._font_large = graphics.Font() self._font_large.LoadFont("rpi-rgb-led-matrix/fonts/10x20.bdf") self._font_small = graphics.Font() self._font_small.LoadFont("rpi-rgb-led-matrix/fonts/6x10.bdf") self._font_tiny = graphics.Font() self._font_tiny.LoadFont("rpi-rgb-led-matrix/fonts/4x6.bdf") # Define colors self._white = graphics.Color(255, 255, 255) self._red = graphics.Color(255, 32, 32) self._blue = graphics.Color(64, 64, 255) rgbtupl = self.random_color() #rgbtupl = self.colorsX(3) self._randcolorH = graphics.Color(int(rgbtupl[0]), int(rgbtupl[1]), int(rgbtupl[2])) rgbtupl = self.random_color() self._randcolorCollon = graphics.Color(int(rgbtupl[0]), int(rgbtupl[1]), int(rgbtupl[2])) rgbtupl = self.random_color() self._randcolorM = graphics.Color(int(rgbtupl[0]), int(rgbtupl[1]), int(rgbtupl[2]))
def __init__(self, rows, cols, refresh_rate=20): self.rows = rows self.cols = cols self.refresh_rate = refresh_rate options = RGBMatrixOptions() options.rows = rows options.cols = cols options.hardware_mapping = 'adafruit-hat' self.options = options self.matrix = RGBMatrix(options=options) self.font = create_font() self.widths = widths( self.font, '$!@#%^*()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-=+_. ' ) self.frame = self.matrix.CreateFrameCanvas()
def __init__(self): # Configuration for the matrix self.options = RGBMatrixOptions() self.options.rows = 64 self.options.cols = 64 self.options.chain_length = 2 self.options.parallel = 2 self.options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat' self.matrix = RGBMatrix(options=self.options)
def __init__(self): super().__init__() self.Away_Team_Logo_X = 0 self.Away_Team_Logo_y = 33 self.Home_Team_Logo_X = 37 self.Home_Team_Logo_y = 33 options = RGBMatrixOptions() options.rows = 32 options.cols = 64 options.chain_length = 2 options.pixel_mapper_config = "U-mapper" options.hardware_mapping = 'adafruit-hat-pwm' options.pwm_lsb_nanoseconds = 130 options.gpio_slowdown = 4 self.matrix = RGBMatrix(options=options) self.buffer = self.matrix.CreateFrameCanvas()
def process(self): self.args = self.parser.parse_args() options = RGBMatrixOptions() if self.args.led_gpio_mapping != None: options.hardware_mapping = self.args.led_gpio_mapping options.rows = self.args.led_rows options.cols = self.args.led_cols options.chain_length = self.args.led_chain options.parallel = self.args.led_parallel options.row_address_type = self.args.led_row_addr_type options.multiplexing = self.args.led_multiplexing options.pwm_bits = self.args.led_pwm_bits options.brightness = self.args.led_brightness options.pwm_lsb_nanoseconds = self.args.led_pwm_lsb_nanoseconds options.led_rgb_sequence = self.args.led_rgb_sequence options.pixel_mapper_config = self.args.led_pixel_mapper if self.args.led_show_refresh: options.show_refresh_rate = 1 if self.args.led_slowdown_gpio != None: options.gpio_slowdown = self.args.led_slowdown_gpio if self.args.led_no_hardware_pulse: options.disable_hardware_pulsing = True self.matrix = RGBMatrix(options = options) try: # Start loop print("Press CTRL-C to stop sample") self.run() except KeyboardInterrupt: print("Exiting\n") sys.exit(0) return True
def process(self): self.args = self.parser.parse_args() options = RGBMatrixOptions() if self.args.led_gpio_mapping != None: options.hardware_mapping = self.args.led_gpio_mapping options.rows = self.args.led_rows options.chain_length = self.args.led_chain options.parallel = self.args.led_parallel options.pwm_bits = self.args.led_pwm_bits options.brightness = self.args.led_brightness options.pwm_lsb_nanoseconds = self.args.led_pwm_lsb_nanoseconds if self.args.led_show_refresh: options.show_refresh_rate = 1 if self.args.led_slowdown_gpio != None: options.gpio_slowdown = self.args.led_slowdown_gpio if self.args.led_no_hardware_pulse: options.disable_hardware_pulsing = True self.matrix = RGBMatrix(options = options) try: # Start loop print("Press CTRL-C to stop sample") signal.signal(signal.SIGTERM, self.exit_process) self.run() except KeyboardInterrupt: print("Exiting\n") sys.exit(0) return True
# image is drawn into a separate buffer, which is then copied to the matrix # using the SetImage() function (see examples below). # Requires rgbmatrix.so present in the same directory. # PIL Image module (create or load images) is explained here: # http://effbot.org/imagingbook/image.htm # PIL ImageDraw module (draw shapes to images) explained here: # http://effbot.org/imagingbook/imagedraw.htm from PIL import Image from PIL import ImageDraw import time from rgbmatrix import RGBMatrix, RGBMatrixOptions # Configuration for the matrix options = RGBMatrixOptions() options.rows = 16 options.chain_length = 1 options.parallel = 1 options.disable_hardware_pulsing = True options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat' matrix = RGBMatrix(options = options) # RGB example w/graphics prims. # Note, only "RGB" mode is supported currently. image = Image.new("RGB", (16, 32)) # Can be larger than matrix if wanted!! draw = ImageDraw.Draw(image) # Declare Draw instance before prims # Draw some shapes into image (no immediate effect on matrix)... draw.rectangle((0, 0, 31, 31), fill=(0, 0, 0), outline=(0, 0, 255)) draw.line((0, 0, 15, 31), fill=(255, 0, 0))
#!/usr/bin/env python import time import sys from rgbmatrix import RGBMatrix, RGBMatrixOptions from PIL import Image if len(sys.argv) < 2: sys.exit("Require an image argument") else: image_file = sys.argv[1] image = Image.open(image_file) # Configuration for the matrix options = RGBMatrixOptions() options.rows = 32 options.chain_length = 1 options.parallel = 1 options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat' matrix = RGBMatrix(options = options) # Make image fit our screen. image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) matrix.SetImage(image.convert('RGB')) try: print("Press CTRL-C to stop.") while True:
def __init__(self, LEDFormat): logging.info('Initialising LEDMatrix') options = RGBMatrixOptions() options.hardware_mapping = LEDFormat['matrixDriver'] options.rows = LEDFormat['matrixRows'] options.cols = LEDFormat['matrixCols'] options.chain_length = LEDFormat['matrixCount'] options.pixel_mapper_config = LEDFormat['matrixMapper'] options.row_address_type = 0 options.multiplexing = 0 options.pwm_bits = 11 options.brightness = 100 options.pwm_lsb_nanoseconds = 130 options.led_rgb_sequence = "RGB" options.show_refresh_rate = 0 self.__MatrixID = RGBMatrix(options = options) self.__MatrixID.Clear() xsize = self.__MatrixID.width ysize = self.__MatrixID.height self.__LEDXSize = xsize self.__LEDYSize = ysize self.__LEDXMax = xsize - 1 self.__LEDYMax = ysize - 1 self.__DrawOnMatrix = True self.__MatrixCanvas = Canvas((self.__LEDXSize, self.__LEDYSize)) self.__FadeMatrixCanvas = Canvas((self.__LEDXSize, self.__LEDYSize)) self.__MatrixBuffer = self.__MatrixID.CreateFrameCanvas()
def led_matrix_options(args): options = RGBMatrixOptions() if args.led_gpio_mapping != None: options.hardware_mapping = args.led_gpio_mapping options.rows = args.led_rows options.cols = args.led_cols options.chain_length = args.led_chain options.parallel = args.led_parallel options.row_address_type = args.led_row_addr_type options.multiplexing = args.led_multiplexing options.pwm_bits = args.led_pwm_bits options.brightness = args.led_brightness options.pwm_lsb_nanoseconds = args.led_pwm_lsb_nanoseconds options.led_rgb_sequence = args.led_rgb_sequence try: options.pixel_mapper_config = args.led_pixel_mapper except AttributeError: debug.warning("Your compiled RGB Matrix Library is out of date.") debug.warning("The --led-pixel-mapper argument will not work until it is updated.") if args.led_show_refresh: options.show_refresh_rate = 1 if args.led_slowdown_gpio != None: options.gpio_slowdown = args.led_slowdown_gpio if args.led_no_hardware_pulse: options.disable_hardware_pulsing = True return options
def led_matrix_options(args): options = RGBMatrixOptions() if args.led_gpio_mapping != None: options.hardware_mapping = args.led_gpio_mapping options.rows = args.led_rows options.cols = args.led_cols options.chain_length = args.led_chain options.parallel = args.led_parallel options.row_address_type = args.led_row_addr_type options.multiplexing = args.led_multiplexing options.pwm_bits = args.led_pwm_bits options.brightness = args.led_brightness options.pwm_lsb_nanoseconds = args.led_pwm_lsb_nanoseconds options.led_rgb_sequence = args.led_rgb_sequence if args.led_show_refresh: options.show_refresh_rate = 1 if args.led_slowdown_gpio != None: options.gpio_slowdown = args.led_slowdown_gpio if args.led_no_hardware_pulse: options.disable_hardware_pulsing = True return options
first_run = True ledpi = LEDPi() while not run_once or first_run: first_run = False matrix = ledpi.display_clock() if matrix: send_matrix(driver, matrix) time.sleep(3) driver.Clear() if __name__ == '__main__': logging.basicConfig( level=logging.INFO, format='%(asctime)s [%(levelname)s] in %(funcName)s: %(message)s') parser = argparse.ArgumentParser() parser.add_argument('--run-once', action='store_true') args = parser.parse_args() options = RGBMatrixOptions() options.rows = 32 options.cols = 32 options.chain_length = 2 options.parallel = 1 options.multiplexing = 0 options.hardware_mapping = 'adafruit-hat-pwm' driver = RGBMatrix(options=options) main(driver, args.run_once)