Skip to content

Commit cd39e67

Browse files
committed
move bytearray.fromhex to ubinascii.unhexlify
1 parent 046b892 commit cd39e67

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_atecc/adafruit_atecc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from struct import pack
4848
from micropython import const
4949
from adafruit_bus_device.i2c_device import I2CDevice
50-
from adafruit_binascii import hexlify
50+
from adafruit_binascii import hexlify, unhexlify
5151

5252
__version__ = "0.0.0-auto.0"
5353
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ATECC.git"
@@ -120,8 +120,8 @@ def _convert_i2c_addr_to_atecc_addr(i2c_addr=0x60):
120120
Byte 16: 20 32 0010 0000 Default 7 bit I2C Address: 0x20>>1: 0x10 ATECC608A-UNKNOWN
121121
"""
122122
CFG_TLS = bytes(
123-
bytearray.fromhex(
124-
"01 23 00 00 00 00 50 00 00 00 00 00 00 c0 71 00"
123+
bytearray(
124+
unhexlify(("01 23 00 00 00 00 50 00 00 00 00 00 00 c0 71 00"
125125
"20 20 20 20 20 20 20 20 20 20 20 20 20 c0 00 55"
126126
"00 83 20 87 20 87 20 87 2f 87 2f 8f 8f 9f 8f af"
127127
"20 20 20 20 20 20 20 20 20 20 20 20 20 8f 00 00"
@@ -134,13 +134,13 @@ def _convert_i2c_addr_to_atecc_addr(i2c_addr=0x60):
134134
"00 33 20 20 20 20 20 20 20 20 20 20 20 20 20 00"
135135
"33 00 33 00 33 00 33 00 1c 00 1c 00 1c 00 3c 00"
136136
"3c 00 3c 00 3c 20 20 20 20 20 20 20 20 20 20 20"
137-
"20 20 00 3c 00 3c 00 3c 00 1c 00"
137+
"20 20 00 3c 00 3c 00 3c 00 1c 00").replace(" ", ""))
138138
)
139139
)
140140

141141
# Convert I2C address to config byte 16 and update CFG_TLS
142142
_CFG_BYTES_LIST = list(bytearray(CFG_TLS))
143-
_CFG_BYTE_16 = bytes(bytearray.fromhex(hex(_I2C_ADDR << 1).replace("0x", "")))
143+
_CFG_BYTE_16 = bytes(bytearray(unhexlify(hex(_I2C_ADDR << 1).replace("0x", ""))))
144144
_CFG_BYTES_LIST_MOD = _CFG_BYTES_LIST[0:16] + list(_CFG_BYTE_16) + _CFG_BYTES_LIST[17:]
145145
CFG_TLS = bytes(_CFG_BYTES_LIST_MOD)
146146

0 commit comments

Comments
 (0)