Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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