Esempio n. 1
0
    def process(self):
        self.args = self.parser.parse_args()

        options = RGBMatrixOptions()

        options.hardware_mapping = "adafruit-hat"
        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
        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
Esempio n. 2
0
    def init_matrix(self):
        args = self.parser.parse_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
        options.pixel_mapper_config = args.led_pixel_mapper
        # Gave error that no options named panel_type existed
        #options.panel_type = args.led_panel_type

        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 RGBMatrix(options=options)
Esempio n. 3
0
    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
Esempio n. 4
0
    def __init__(self, config):
        from rgbmatrix import RGBMatrix, RGBMatrixOptions
        options = RGBMatrixOptions()

        options.rows = config.getint('rows')
        options.cols = config.getint('cols')
        options.hardware_mapping = config['led_hardware_mapping']

        options.chain_length = config.getint('led_chain')
        options.parallel = config.getint('led_parallel')
        options.pwm_bits = config.getint('led_pwm_bits')
        options.brightness = config.getint('led_brightness')
        options.pwm_lsb_nanoseconds = config.getint('led_pwm_lsb_nanoseconds')
        options.inverse_colors = config.getboolean('led_inverse')
        options.led_rgb_sequence = config['led_rgb_sequence']
        options.pixel_mapper_config = config['led_pixel_mapper']
        options.row_address_type = config.getint('led_row_addr_type')
        options.multiplexing = config.getint('led_multiplexing')
        options.scan_mode = config.getint('led_scan_mode')
        options.gpio_slowdown = config.getint('led_slowdown_gpio')
        options.disable_hardware_pulsing = config.getboolean(
            'led_no_hardware_pulse')
        options.show_refresh_rate = config.getboolean('led_show_refresh')
        options.pwm_dither_bits = config.getint('led_pwm_dither_bits')
        #options.panel_type = config['led_panel_type']

        self.matrix = RGBMatrix(options=options)
        self.offscreen_canvas = self.matrix.CreateFrameCanvas()
Esempio n. 5
0
    def __init__(self, options, font=defaultFont):
        self._logger = LogManager.get_logger(__name__)
        self._logger.debug("Initializing display with '{0}'".format(options))

        matrix_options = RGBMatrixOptions()

        matrix_options.hardware_mapping = options.led_gpio_mapping
        matrix_options.rows = options.led_rows
        matrix_options.cols = options.led_cols
        matrix_options.chain_length = options.led_chain
        matrix_options.parallel = options.led_parallel
        matrix_options.row_address_type = options.led_row_addr_type
        matrix_options.multiplexing = options.led_multiplexing
        matrix_options.pwm_bits = options.led_pwm_bits
        matrix_options.brightness = options.led_brightness
        matrix_options.pwm_lsb_nanoseconds = options.led_pwm_lsb_nanoseconds
        matrix_options.led_rgb_sequence = options.led_rgb_sequence
        matrix_options.show_refresh_rate = options.led_show_refresh
        matrix_options.gpio_slowdown = options.led_slowdown_gpio
        matrix_options.disable_hardware_pulsing = options.led_no_hardware_pulse

        self._matrix = RGBMatrix(options = matrix_options)
        self._offscreen_canvas = self._matrix.CreateFrameCanvas()

        self._font = font
Esempio n. 6
0
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)
Esempio n. 7
0
def init_matrix():
    global _state

    options = RGBMatrixOptions()
    options.hardware_mapping = const.scr_led_gpio_mapping
    options.rows = const.scr_led_rows
    options.cols = const.scr_led_cols
    options.chain_length = const.scr_led_chain
    options.parallel = const.scr_led_parallel
    options.row_address_type = const.scr_row_address_type
    options.multiplexing = const.scr_led_multiplexing
    options.pwm_bits = const.scr_led_pwm_bits
    options.brightness = _state.currentBrightness
    options.pwm_lsb_nanoseconds = const.scr_led_pwm_lsb_nanoseconds
    options.led_rgb_sequence = const.scr_led_rgb_sequence
    if const.scr_led_show_refresh:
        options.show_refresh_rate = 1
    if const.scr_led_slowdown_gpio is not None:
        options.gpio_slowdown = const.scr_led_slowdown_gpio
    if const.scr_led_no_hardware_pulse:
        options.disable_hardware_pulsing = True
    options.pixel_mapper_config = const.scr_pixel_mapper_config

    # https://github.com/hzeller/rpi-rgb-led-matrix/issues/679#issuecomment-423268899
    _state.matrix = RGBMatrix(options=options)

    for fontFilename in ["10x20", "6x9", "5x8"]:
        font = graphics.Font()
        font.LoadFont("{}/{}.bdf".format(const.scr_fonts_dir, fontFilename))
        _state.fonts.append(font)

    logger.debug("matrix canvas initialized")
Esempio n. 8
0
    def __init__(self, debug=False):
        self.debug = debug
        self.width = 64
        self.height = 32
        defaultColor = Color(0, 0, 0)
        self.values = []
        self.oldvalues = []

        for y in range(self.height):
            row = []
            for x in range(self.width):
                row.append(defaultColor)
            self.values.append(row)

        if self.debug:
            import pygame
            self.pygame = pygame
            self.pygame.init()
            self.pixelModifier = 8
            self.surface = pygame.display.set_mode(
                (self.width * self.pixelModifier + self.width,
                 self.height * self.pixelModifier + self.height))
            self.pygame.display.set_caption("LED Matrix Simulator")
        else:
            from rgbmatrix import RGBMatrix, RGBMatrixOptions
            options = RGBMatrixOptions()
            options.rows = self.height
            options.cols = self.width
            options.brightness = 5
            options.hardware_mapping = 'adafruit-hat'

            self.matrix = RGBMatrix(options=options)
            self.canvas = self.matrix.CreateFrameCanvas()
Esempio n. 9
0
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
Esempio n. 10
0
def setupDisplay():
    options = RGBMatrixOptions()
    options.rows = 16
    options.cols = 32
    options.brightness = 100
    display = RGBMatrix(options=options)
    return display
Esempio n. 11
0
    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
        if self.args.led_slowdown_gpio != None:
            options.gpio_slowdown = self.args.led_slowdown_gpio
        options.pwm_lsb_nanoseconds = self.args.led_pwm_lsb_nanoseconds
        options.pwm_bits = self.args.led_pwm_bits

        options.rows = self.args.led_rows
        options.cols = self.args.led_cols
        options.brightness = self.args.led_brightness

        if self.args.led_show_refresh:
            options.show_refresh_rate = 1
        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
Esempio n. 12
0
def matrix_options():
    '''
        Params:
            options     - Display Board connection options
            matrix      - Sets the options
        Returns:
            matrix, offscreen_canvas
    '''
    
    options = RGBMatrixOptions()

    options.rows = 16
    options.cols = 32
    options.gpio_slowdown = 4
    options.brightness = 100
    options.chain_length = 1
    options.parallel = 1
    options.row_address_type = 0
    options.pwm_bits = 11
    options.pwm_lsb_nanoseconds = 130
    options.led_rgb_sequence = 'RGB' 
    options.pixel_mapper_config = ''
    #options.panel_type = '' # -> supported: str('FM6126A')
    options.show_refresh_rate = 0
    #options.hardware_mapping = 'regular'

    matrix = RGBMatrix(options = options)
    
    offscreen_canvas = matrix.CreateFrameCanvas()

    return (matrix, offscreen_canvas)
Esempio n. 13
0
def initialize():
    global options, matrix, canvas, store
    global default_font, light_font

    options = RGBMatrixOptions()
    options.rows = led_rows
    options.cols = led_cols
    options.chain_length = led_chain
    options.parallel = led_parallel
    options.brightness = led_brightness
    options.hardware_mapping = led_hardware_mapping
    options.disable_hardware_pulsing = True
    options.pwm_lsb_nanoseconds = 130

    # if you're not using raspberry pi 3 comment line below
    options.gpio_slowdown = 2

    matrix = RGBMatrix(options=options)
    canvas = matrix.CreateFrameCanvas()

    default_font = graphics.Font()
    default_font.LoadFont(default_font_path)

    light_font = graphics.Font()
    light_font.LoadFont(light_font_path)

    store = redis.StrictRedis(host='localhost', port=6379, db=0)
Esempio n. 14
0
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
Esempio n. 15
0
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"))
Esempio n. 16
0
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 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")
            self.run()
        except KeyboardInterrupt:
            print("Exiting\n")
            sys.exit(0)

        return True
Esempio n. 18
0
    def process(self):
        self.args = self.parser.parse_args()

        options = RGBMatrixOptions()

        if self.args.led_gpio_mapping is not 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 is not 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)

        return True
Esempio n. 19
0
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)
Esempio n. 20
0
 def __init__(self, brightness=50):
     # Configuration for the matrix
     options = RGBMatrixOptions()
     options.brightness = brightness
     options.rows = 32
     options.chain_length = 1
     options.parallel = 1
     options.hardware_mapping = 'adafruit-hat'  # If you have an Adafruit HAT: 'adafruit-hat'
     self.matrix = RGBMatrix(options=options)
Esempio n. 21
0
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)
Esempio n. 22
0
    def initialize_and_run(self):
        self.args = self.parser.parse_args()

        logging_level = logging.getLevelName(self.args.log_level)
        self.logging = logging.basicConfig(level=logging_level, format='%(asctime)-15s [%(levelname)s] (%(threadName)-10s) %(message)s', )

        logging.info("Initializing LED matrix...")
        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
        options.led_rgb_sequence = self.args.led_rgb_sequence

        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)

        #self.led_pulse_cache = FanoutCache(self.args.cache_location, shards=20, timeout=1)
        self.columns = self.args.led_rows * self.args.led_chain
        self.rows = 32

        # TODO: configure me
        self.pulse_events_url = "http://192.168.1.7:9201/events"

        # TODO: configure me
        self.target_fps = 24.
        self.time_per_frame_ms = (1 / self.target_fps) * 1000.

        self.draw_state = DrawState()
        self.stop_event = threading.Event()

        try:
            # Start loop
            print("Press CTRL-C to stop sample")
            self.run()
        except KeyboardInterrupt:
            print("Exiting\n")
            self.stop_event.set()
            sys.exit(0)

        return True
Esempio n. 23
0
 def __init__(self, d='art/', brightness=50):
     self.images = os.listdir(d)
     # Configuration for the matrix
     options = RGBMatrixOptions()
     options.brightness = brightness
     options.rows = 32
     options.chain_length = 1
     options.parallel = 1
     options.hardware_mapping = 'adafruit-hat'  # If you have an Adafruit HAT: 'adafruit-hat'
     self.matrix = RGBMatrix(options=options)
     self.imageDirectory = d
Esempio n. 24
0
 def setup(self):
     logger.info("setting up the matrix: %s", getpass.getuser())
     options = RGBMatrixOptions()
     options.rows = 16
     options.chain_length = 1
     options.brightness = BRIGHTNESS
     options.daemon = 0
     options.drop_privileges = 0
     self.matrix = RGBMatrix(options=options)
     logger.info("matrix setup is done: %s", getpass.getuser())
     return
Esempio n. 25
0
def main():
    options = RGBMatrixOptions()
    options.gpio_slowdown = 3
    options.brightness = 50
    options.rows = 32
    options.cols = 64

    # matrix = BandsMatrix(options=options)
    matrix = WindTrail(options=options)

    matrix.run()
Esempio n. 26
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)
Esempio n. 27
0
    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
Esempio n. 28
0
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)
Esempio n. 29
0
def gen_options(cfg):
    options = RGBMatrixOptions()

    options.chain_length = int(cfg['display']['chain'])
    options.rows = int(cfg['display']['rows'])
    options.cols = int(cfg['display']['cols'])
    options.brightness = float(cfg['display']['brightness'])
    options.hardware_mapping = cfg['display']['hardware_mapping']

    options.show_refresh_rate = int(
        cfg['display']['debug']['show_refresh_rate'])

    return options
Esempio n. 30
0
    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):
        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()
Esempio n. 32
0
 def __init__(self, brightness: int):
     options = RGBMatrixOptions()
     options.brightness = brightness
     options.rows = 32
     options.cols = 64
     options.chain_length = 1
     options.parallel = 1
     options.pwm_bits = 11
     options.hardware_mapping = 'regular'
     options.pwm_lsb_nanoseconds = 130
     options.gpio_slowdown = 1
     options.led_rgb_sequence = 'RGB'
     options.pixel_mapper_config = ''
     options.row_address_type = 0
     options.multiplexing = 0
     self.matrix = RGBMatrix(options=options)
Esempio n. 33
0
    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()