1 # SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries
3 # SPDX-License-Identifier: MIT
7 ================================================================================
11 **Software and Dependencies:**
14 https://github.com/adafruit/Adafruit_Blinka/releases
16 * Author(s): Melissa LeBlanc-Williams
20 __version__ = "0.0.0+auto.0"
21 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
24 def clamp(value, min_value, max_value):
25 """Clamp a value between a minimum and maximum value"""
26 return max(min(max_value, value), min_value)
30 """Swap the bytes in a 16 bit value"""
31 return (value & 0xFF00) >> 8 | (value & 0x00FF) << 8
34 def read_word(header: memoryview, index: int) -> int:
35 """Read a 32-bit value from a memoryview cast as 16-bit values"""
36 return header[index] | header[index + 1] << 16