Skip to content

Commit f170e93

Browse files
committed
adafruit_si4713: prefer 'struct', falling back to 'ustruct'
1 parent 1210a49 commit f170e93

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_si4713.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
import time
3333

3434
from micropython import const
35-
import ustruct
35+
try:
36+
import struct
37+
except:
38+
import ustruct as struct
3639

3740
import adafruit_bus_device.i2c_device as i2c_device
3841

@@ -379,7 +382,7 @@ def input_level(self):
379382
"""
380383
# Perform ASQ request, then parse out 8 bit _signed_ input level value.
381384
self._asq_status()
382-
return ustruct.unpack('bbbbb', self._BUFFER)[4]
385+
return struct.unpack('bbbbb', self._BUFFER)[4]
383386

384387
@property
385388
def audio_signal_status(self):

0 commit comments

Comments
 (0)