X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/blobdiff_plain/622133713388c31604224bd5b5b758a28b3cf4b0..0d243252f0fb3a3e200df404884e3cc7d872ee13:/displayio/_helpers.py diff --git a/displayio/_helpers.py b/displayio/_helpers.py new file mode 100644 index 0000000..cbff9f4 --- /dev/null +++ b/displayio/_helpers.py @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +""" +`displayio.helpers` +================================================================================ + +displayio for Blinka + +**Software and Dependencies:** + +* Adafruit Blinka: + https://github.com/adafruit/Adafruit_Blinka/releases + +* Author(s): Melissa LeBlanc-Williams + +""" + +__version__ = "0.0.0+auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git" + +def clamp(value, min_value, max_value): + """Clamp a value between a minimum and maximum value""" + return max(min(max_value, value), min_value) + +def bswap16(value): + """Swap the bytes in a 16 bit value""" + return (value & 0xFF00) >> 8 | (value & 0x00FF) << 8 \ No newline at end of file