How to use the cryptoauthlib.exceptions.UnsupportedDeviceError function in cryptoauthlib

To help you get started, we’ve selected a few cryptoauthlib 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 dmazzella / ucryptoauthlib / cryptoauthlib / basic.py View on Github external
def atcab_selftest(self, mode, param2=0):
        if self._device != "ATECC608A":
            raise ATCA_EXCEPTIONS.UnsupportedDeviceError("atcab_selftest")
        packet = ATCAPacket(
            opcode=ATCA_CONSTANTS.ATCA_SELFTEST,
            param1=mode,
            param2=param2
        )
        self.execute(packet)
        RSP_DATA_IDX = ATCA_CONSTANTS.ATCA_RSP_DATA_IDX
        return packet[RSP_DATA_IDX] & int(not mode) == ATCA_STATUS.ATCA_SUCCESS
github dmazzella / ucryptoauthlib / cryptoauthlib / device.py View on Github external
def __init__(
            self,
            bus=machine.I2C(1, freq=133000),
            address=I2C_ADDRESS, retries=RX_RETRIES):

        if address not in bus.scan():
            raise ATCA_EXCEPTIONS.NoDevicesFoundError()

        self._bus = bus
        self._address = address
        self._retries = retries
        try:
            self._device = SUPPORTED_DEVICES[self.atcab_info()[1+2]]
        except KeyError:
            raise ATCA_EXCEPTIONS.UnsupportedDeviceError()