How to use the pfio.GPIOB function in pfio

To help you get started, we’ve selected a few pfio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thomasmacpherson / piface / python / piface / spivisualiser.py View on Github external
cmd = "WRITE"
        elif cmd == pfio.READ_CMD:
            cmd = "READ"
        else:
            cmd = hex(cmd)

        port = (raw_data >> 8) & 0xff
        if port == pfio.IODIRA:
            port = "IODIRA"
        elif port == pfio.IODIRB:
            port = "IODIRB"
        elif port == pfio.IOCON:
            port = "IOCON"
        elif port == pfio.GPIOA:
            port = "GPIOA"
        elif port == pfio.GPIOB:
            port = "GPIOB"
        elif port == pfio.GPPUA:
            port = "GPPUA"
        elif port == pfio.GPPUB:
            port = "GPPUB"
        else:
            port = hex(port)

        data = hex(raw_data & 0xff)

        data_breakdown = "cmd: %s, port: %s, data: %s" % (cmd, port, data)
        return data_breakdown