Example #1
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
Example #2
0
    def __init__(self,
                 *,
                 rows=32,
                 columns=64,
                 chain=1,
                 brightness=80,
                 gpio_mapping="adafruit-hat-pwm",
                 parallel=1,
                 pwm_bits=11,
                 panel_type="",
                 rgb_sequence="rgb",
                 show_refresh=False,
                 slowdown_gpio=None,
                 no_hardware_pulse=False,
                 pwm_lsb_nanoseconds=130,
                 row_addr_type=0,
                 multiplexing=0,
                 pixel_mapper=""):
        options = RGBMatrixOptions()
        options.drop_privileges = 0
        options.daemon = 0
        options.hardware_mapping = gpio_mapping
        options.rows = rows
        options.cols = columns
        options.chain_length = chain
        options.parallel = parallel
        options.pwm_bits = pwm_bits
        options.brightness = brightness
        options.panel_type = panel_type
        options.led_rgb_sequence = rgb_sequence
        options.pwm_lsb_nanoseconds = pwm_lsb_nanoseconds
        options.row_address_type = row_addr_type
        options.multiplexing = multiplexing
        options.pixel_mapper_config = pixel_mapper

        if show_refresh:
            options.show_refresh_rate = 1
        if slowdown_gpio is not None:
            options.gpio_slowdown = slowdown_gpio
        if no_hardware_pulse:
            options.disable_hardware_pulsing = True

        self._matrix = RGBMatrix(options=options)
        self._buffer = self._matrix.CreateFrameCanvas()
        self._background = (0, 0, 0)
        self._position = (0, 0)
    def __init__(self):
        print("__init__")

        options = RGBMatrixOptions()
        options.hardware_mapping = "adafruit-hat-pwm"
        options.rows = 32
        options.cols = 64

        options.chain_length = 1
        options.parallel = 1
        options.row_address_type = 0
        options.multiplexing = 0
        options.pwm_bits = 11
        options.brightness = 100
        options.disable_hardware_pulsing = 0
        #options.pwm_lsb_nanoseconds = 130
        options.pwm_lsb_nanoseconds = 500  # 400=Good
        options.led_rgb_sequence = "RGB"
        options.pixel_mapper_config = ""
        options.show_refresh_rate = 0
        options.gpio_slowdown = 0
        options.daemon = 0
        options.drop_privileges = False

        self.matrix = RGBMatrix(options=options)

        self.offscreen_canvas = self.matrix.CreateFrameCanvas()
        self.font = graphics.Font()
        self.fontSmall = graphics.Font()

        # Setup Fonts
        # Get fonts from here: https://github.com/dk/ibm-vio-os2-fonts
        #self.font.LoadFont("../../../fonts/10x20.bdf")
        #self.font.LoadFont("ibm-vio-12x20-r-iso10646-1-20.bdf")

        self.fontSmall.LoadFont(
            "fonts/ibm-vio-6x10-r-iso10646-1-10-modified.bdf")
        self.font.LoadFont("fonts/ibm-vio-12x30-r-iso10646-1-30-modified.bdf")
        #self.font.LoadFont("fonts/ibm-vio-10x21-r-iso10646-1-21.bdf")
        #self.font.LoadFont("fonts/ibm-vio-12x22-r-iso10646-1-22-modified.bdf")
        #self.font.LoadFont("../../../fonts/helvR12.bdf")
        self.matrix.brightness = 100
        #self.textColor = graphics.Color(255, 0, 0)
        logger.info("display adafruit hat init complete")
def rgbmatrix_options():
    options = RGBMatrixOptions()
    options.multiplexing = 6
    options.row_address_type = 0
    options.brightness = 80
    options.rows = number_of_rows_per_panel
    options.cols = number_of_columns_per_panel
    options.chain_length = number_of_panels
    options.parallel = parallel
    options.hardware_mapping = 'regular'
    options.inverse_colors = False
    options.led_rgb_sequence = "BGR"
    options.gpio_slowdown = 1
    options.pwm_lsb_nanoseconds = 130
    options.show_refresh_rate = 0
    options.disable_hardware_pulsing = False
    options.scan_mode = 0
    options.pwm_bits = 11
    options.daemon = 0
    options.drop_privileges = 0
    return options
Example #5
0
def rgbmatrix_options():
    options = RGBMatrixOptions()
    options.multiplexing = 0
    options.row_address_type = 0
    options.brightness = 100
    options.rows = led_panel_height
    options.cols = led_panel_width
    options.chain_length = 1
    options.parallel = 1
    options.hardware_mapping = 'regular'
    options.inverse_colors = False
    options.led_rgb_sequence = "RGB"
    options.gpio_slowdown = 3
    options.pwm_lsb_nanoseconds = 150
    options.show_refresh_rate = 0
    options.disable_hardware_pulsing = True
    options.scan_mode = 0
    options.pwm_bits = 11
    options.daemon = 0
    options.drop_privileges = 0
    return options
Example #6
0
def InitMatrix():
    """Class for calling all graphical functions for the matrix."""
    # OPTIONS
    options = RGBMatrixOptions()
    options.rows = 16
    options.cols = 32
    options.chain_length = 1
    options.parallel = 1
    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.pixel_mapper_config = ""
    options.gpio_slowdown = 3
    options.drop_privileges = 0
    options.daemon = 0
    # Test speed
    # options.show_refresh_rate = 1 #~530HZ on wiimote version

    return RGBMatrix(options=options)
Example #7
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
        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
        options.drop_privileges = 0
        options.daemon = 0

        if self.args.led_show_refresh:
            options.show_refresh_rate = 1

        options.gpio_slowdown = 2
        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
Example #8
0
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
if args.led_show_refresh:
    options.show_refresh_rate = 1
if args.led_slowdown_gpio is not None:
    options.gpio_slowdown = args.led_slowdown_gpio
if args.led_no_hardware_pulse:
    options.disable_hardware_pulsing = True
options.daemon = args.daemon
options.drop_privileges = 0

writeppm = bool(args.write_ppm)
ppmfile = args.write_ppm
options.pixelsvector = writeppm

gpiotest = False
gpiotest_minb = 10
gpiotest_maxb = 65

if gpiotest:
    available_inputs = matrix.GPIORequestInputs(0xffffffff)

### Fonts