Skip to content

Instantly share code, notes, and snippets.

View DaelonSuzuka's full-sized avatar
💭
LFG

David Kincaid DaelonSuzuka

💭
LFG
View GitHub Profile
@DaelonSuzuka
DaelonSuzuka / Example.gd
Last active February 16, 2022 15:22
MenuButton.gd
extends Control
# ******************************************************************************
onready var MenuButton = find_node('MenuButton')
# ******************************************************************************
func _ready():
# Add an optional callback when you create a menu item
@DaelonSuzuka
DaelonSuzuka / spi_bitbang.c
Last active November 4, 2021 02:47
SPI bitbang driver
#include "stdint.h"
/* ************************************************************************** */
#define set_STROBE_PIN(state) LATXbits.LATXY = state // your register here
#define set_CLOCK_PIN(state) LATXbits.LATXY = state // your register here
#define set_DATA_PIN(state) LATXbits.LATXY = state // your register here
static void spi_bitbang_tx_word(uint16_t word) {
@DaelonSuzuka
DaelonSuzuka / filesystem.gd
Created October 16, 2021 17:00
godotscript filesystem helpers
static func get_dir_files(path: String) -> PoolStringArray:
var arr: PoolStringArray
var dir := Directory.new()
dir.open(path)
if dir.file_exists(path):
arr.append(path)
else:
@DaelonSuzuka
DaelonSuzuka / ObserverCam2D.gd
Created October 13, 2021 08:33
Godot ObserverCam2D
extends Camera2D
# This script turns a Camera2D into a mouse-controllable ObserverCamera
# Holding the Middle Mouse button and moving the mouse pans the camera
# Mouse Scroll Wheel zooms the camera in and out
# Clicking the Middle Mouse button without moving the camera resets the camera
@DaelonSuzuka
DaelonSuzuka / discovery.py
Last active December 18, 2020 02:23
discovery
from qt import *
import time
import json
import logging
from .utils import get_ip
import socket
class Host:
def __init__(self, address, beacon_message, timeout=10):
@DaelonSuzuka
DaelonSuzuka / bundles.md
Last active July 12, 2020 13:23
QThread example using bundled signals/slots

Bundles

This module provides a pair of classes that can be used to automate the construction of object interfaces using qt Signal()s and Slot()s.

Sales pitch:

  • Reduced Boilerplate!

These classes lets you define a lot of signals or slots with just a couple lines

@DaelonSuzuka
DaelonSuzuka / SerialDevice.py
Last active June 21, 2021 02:25
SerialDevice Stuff
import json
from .serial_device_base import SerialDeviceBase
from time import time
from qt import *
fake_guid = 0
def get_fake_guid():
global fake_guid
e38bdb922f31e4ccb633a62582fb60411bc09908
profiles = {p.profile_name: p for p in UnknownDevice.__subclasses__()}
class DeviceManager:
def __init__(self):
log.info("Initializing DeviceManager...")
self.devices = {}
self.new_devices = []
self.last_scan_time = 0
self.ports = []
@DaelonSuzuka
DaelonSuzuka / log.c
Created June 20, 2020 03:47
logging module
#include "log.h"
#include "serial_port.h"
#include "shell/shell_utils.h"
#include "system_time.h"
#include <ctype.h>
#include <stdbool.h>
#include <string.h>
/* ************************************************************************** */