X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/blobdiff_plain/8dc304ff4f82d37e493b9500e17fb13799dc200f..cfee25c8ae316776ce54589eae64409ea41bc42b:/displayio/_helpers.py diff --git a/displayio/_helpers.py b/displayio/_helpers.py index 39e1c11..2d77730 100644 --- a/displayio/_helpers.py +++ b/displayio/_helpers.py @@ -29,3 +29,8 @@ def clamp(value, min_value, max_value): def bswap16(value): """Swap the bytes in a 16 bit value""" return (value & 0xFF00) >> 8 | (value & 0x00FF) << 8 + + +def read_word(header: memoryview, index: int) -> int: + """Read a 32-bit value from a memoryview cast as 16-bit values""" + return header[index] | header[index + 1] << 16