Skip to content

Instantly share code, notes, and snippets.

@kmatch98
kmatch98 / gist:097a34177b68480e511179f9eeb8d909
Created August 31, 2023 00:08
GT911 CircuitPython driver, barely working.
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython I2C Device Address Scan"""
# If you run this and it seems to hang, try manually unlocking
# your I2C bus from the REPL with
# >>> import board
# >>> board.I2C().unlock()
@kmatch98
kmatch98 / code_interrupt.py
Created August 5, 2022 03:15
HACKtablet drawing speedup by using touch interrupt pin
# ___ ___ _____ _________ ____ __. __ ___. .__ __
# / | \ / _ \ \_ ___ \ | |/ _|_/ |_ _____ \_ |__ | | ____ _/ |_
# / ~ \ / /_\ \ / \ \/ | < \ __\\__ \ | __ \ | | _/ __ \ \ __\
# \ Y // | \\ \____| | \ | | / __ \_ | \_\ \| |__\ ___/ | |
# \___|_ / \____|__ / \______ /|____|__ \ |__| (____ / |___ /|____/ \___ > |__|
# \/ \/ \/ \/ \/ \/ \/
#
# Thank you for agreeing to hack on this HACKtablet!
# I hope you enjoy exploring what you can achieve
# this touchscreen CircuitPython device.
@kmatch98
kmatch98 / esp_lcd_panel_ops.h
Created July 15, 2022 23:36
My changes to the ESP-IDF to enable CircuitPython to use an RGB display.
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include "esp_err.h"
#include "esp_lcd_types.h"
@kmatch98
kmatch98 / gist:32df3bece4be2ce7c9ed983049b10617
Created March 19, 2022 13:38
Creates a Line using CircuitPython's vectorio Polygon given two endpoints and the line stroke width
@staticmethod
def _angled_rectangle(points, palette, stroke=1):
x1, y1 = points[0]
x2, y2 = points[1]
if ((x2-x1) == 0):
xdiff1 = round(stroke/2)
xdiff2 = -round(stroke-xdiff1)
ydiff1 = 0
ydiff2 = 0
@kmatch98
kmatch98 / __init__.py
Created May 18, 2021 19:29
Modified `adafruit_pyportal` library with scale parameter added.
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
`adafruit_pyportal`
================================================================================
CircuitPython driver for Adafruit PyPortal.
* Author(s): Limor Fried, Kevin J. Walters, Melissa LeBlanc-Williams
@kmatch98
kmatch98 / main.c
Created March 30, 2021 00:53
Trying a simple blink code to verify loading Compiled C code onto an ItsyBitsy.
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Scott Shawcroft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@kmatch98
kmatch98 / code.py
Created March 18, 2021 19:07
Touch deck code with IconAnimated icons.
# SPDX-FileCopyrightText: 2021 Tim C, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
"""
import gc
import time
@kmatch98
kmatch98 / blit_rotate_scale.py
Created March 15, 2021 20:01
Blit rotate scale in python
# /*
# Reference:
# "Fast Bitmap Rotation and Scaling" By Steven Mortimer, Dr Dobbs' Journal, July 01, 2001
# http://www.drdobbs.com/architecture-and-design/fast-bitmap-rotation-and-scaling/184416337
# See also http://www.efg2.com/Lab/ImageProcessing/RotateScanline.htm
# */
# pylint: disable=invalid-name, too-many-branches, too-many-statements
# This function is provided in case the bitmaptools.rotozoom function is not available
@kmatch98
kmatch98 / touch_deck.py
Last active March 16, 2021 19:41
Example touch_deck to exercise the icon_widget that is in development for adafruit_displayio_layout
# SPDX-FileCopyrightText: 2021 Tim C, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
"""
import storage
import gc
@kmatch98
kmatch98 / code.py
Last active March 14, 2021 04:49
icon_widget with zoom pressed/released animation added.
# SPDX-FileCopyrightText: 2021 Tim C, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
"""
import time
import board
import displayio
import terminalio