adafruit / Adafruit_CircuitPython_ATECC

Driver for Microchip ATECCx08 cryptographic co-processors with secure hardware-based key storage
Other
18 stars 19 forks source link

Uses bytearray.fromhex which isn't in CircuitPython #24

Closed dastels closed 3 years ago

dastels commented 3 years ago

There are two calls to bytearray.fromhex in adafruit_atecc.py but bytearray doesn't support/include a fromhex method in CircuitPython.

`CFG_TLS = bytes( bytearray.fromhex( "01 23 00 00 00 00 50 00 00 00 00 00 00 c0 71 00" "20 20 20 20 20 20 20 20 20 20 20 20 20 c0 00 55" "00 83 20 87 20 87 20 87 2f 87 2f 8f 8f 9f 8f af" "20 20 20 20 20 20 20 20 20 20 20 20 20 8f 00 00" "00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 20" "20 20 20 20 20 20 20 20 20 af 8f ff ff ff ff 00" "00 00 00 ff ff ff ff 00 20 20 20 20 20 20 20 20" "20 20 20 20 20 00 00 00 ff ff ff ff ff ff ff ff" "ff ff ff ff 20 20 20 20 20 20 20 20 20 20 20 20" "20 ff ff ff ff 00 00 55 55 ff ff 00 00 00 00 00" "00 33 20 20 20 20 20 20 20 20 20 20 20 20 20 00" "33 00 33 00 33 00 33 00 1c 00 1c 00 1c 00 3c 00" "3c 00 3c 00 3c 20 20 20 20 20 20 20 20 20 20 20" "20 20 00 3c 00 3c 00 3c 00 1c 00" ) )

_CFG_BYTES_LIST = list(bytearray(CFG_TLS)) _CFG_BYTE_16 = bytes(bytearray.fromhex(hex(_I2C_ADDR << 1).replace("0x", "")))`

ladyada commented 3 years ago

@dastels ok please submit a PR

silvester commented 3 years ago

This should be fixed with the latest commit.