Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# check we are three bytes long
if len(hex(spi_message)[2:]) > 6:
raise ValueError()
except ValueError:
msg = "Invalid SPI message"
self.error_text = msg
print msg
return
cmd = (spi_message >> 16) & 0xff
port = (spi_message >> 8) & 0xff
data = (spi_message) & 0xff
pfio.send([(cmd, port, data)], True)