Skip to content

Instantly share code, notes, and snippets.

View max-dark's full-sized avatar
🇷🇺

Maxim Timakov max-dark

🇷🇺
View GitHub Profile
@max-dark
max-dark / custom-rp2040-in-openocd.md
Last active March 20, 2025 00:40
small patches for custom boards with RP2040 MCU
  • Fix deprecation warning for board/pico-debug.cfg
  • Add support for FLASH_SIZE customisation in target/rp2040.cfg (Allow skip flash auto_probe)
  • Add support for 2 new NOR Flash in src/flash/nor/spi.c (Fix "Error: Unknown flash device")
@max-dark
max-dark / ov7670_registers.h
Last active March 11, 2025 14:52
OmniVision OV7670 RegisterSet
#ifndef OV7670_REGISTERS_H
#define OV7670_REGISTERS_H
#pragma once
/**
* @brief OmniVision OV7670 RegisterSet
*
* Provides a list and description of the Device Control registers contained in the OV7670/OV7171.
* For all register Enable/Disable bits, ENABLE = 1 and DISABLE = 0.
@max-dark
max-dark / sump_protocol.cxx
Last active March 3, 2025 14:54
draft for SUMP protocol parser
// See: Openbench Logic Sniffer (OLS) / SUMP protocol
// https://sigrok.org/wiki/SUMP_compatibles
// https://sigrok.org/wiki/Openbench_Logic_Sniffer
// https://sigrok.org/gitweb/?p=libsigrok.git;a=blob_plain;f=src/hardware/openbench-logic-sniffer/protocol.h;hb=HEAD
// https://firmware.buspirate.com/binmode-reference/protocol-sump
// https://web.archive.org/web/20190317154112if_/http://mygizmos.org/ols/Logic-Sniffer-FPGA-Spec.pdf
#include <QCoreApplication>
#include <QDebug>
@max-dark
max-dark / gd32f1xx.tcl
Created February 26, 2025 19:21
OpenOCD config for GD32F1xx MCU
# file gd32f1xx.cfg
# script for gd32f1x family
set CPUTAPID 0x2ba01477
# optional name
set CHIPNAME gd32f1x
# autodetect flash size
# set FLASH_SIZE 0
# use SWD
@max-dark
max-dark / blackpill.ioc
Last active March 2, 2025 22:22
STM32CubeMX projects for BlackPill (stm32f401ccu6) / BluePill (stm32f103c8t6)
#MicroXplorer Configuration settings - do not modify
CAD.formats=
CAD.pinconfig=
CAD.provider=
FREERTOS.IPParameters=Tasks01,configUSE_NEWLIB_REENTRANT
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
FREERTOS.configUSE_NEWLIB_REENTRANT=1
File.Version=6
GPIO.groupedBy=Group By Peripherals
KeepUserPlacement=false
@max-dark
max-dark / motor-gear-mount.scad
Last active February 19, 2025 09:01
motor-gear MG90S for OpenSCAD
// MG90S mount
include <motor-gears.scad>
MG_MOUNT_W = 4.4;
MG_MOUNT_D = 0.2;
MG_MOUNT_HOLE_D = MG90S_MOUNT_HOLE_D - 0.2;
MG_MOUNT_SIZE=[
MG90S_BLOCK_SIZE.x + 2 * (MG_MOUNT_W + MG_MOUNT_D)
, MG90S_BLOCK_SIZE.y
, MG90S_MOUNT_OFFSET + MG_MOUNT_W
@max-dark
max-dark / arduino_uno.scad
Last active February 19, 2025 03:50
Arduino Uno R3 mount holes
/*
0
+--> X (width)
|
V
Y (height)
+---------------------------.
| o<-a \
+-----+ |
| USB | \
@max-dark
max-dark / utf_decode.cxx
Created December 1, 2024 02:43
utf decode
// https://en.wikipedia.org/wiki/UTF-8
#include <iostream>
#include <string>
#include <iomanip>
using u_char = unsigned char;
enum utf_mask: u_char
{
@max-dark
max-dark / install-gpio-permissions.sh
Created October 28, 2024 20:20
add RW permissions to /dev/gpiochip*
#!/bin/sh
RULES_TMP_FILE=/tmp/99-gpio-subsystem.rules
# add 'gpio' group
/usr/sbin/addgroup --system gpio
# install udev rules
/usr/bin/echo 'SUBSYSTEM=="gpio", MODE="0660", GROUP="gpio"' > "$RULES_TMP_FILE"
/usr/bin/install --verbose --mode=0644 "$RULES_TMP_FILE" /etc/udev/rules.d/
@max-dark
max-dark / fill_project.cmake
Last active October 21, 2024 14:18
convert vc project to cmake
# add target from generated "*.cmake"
function(fill_project VC_PROJECT_FILE CONFIG_NAME)
set(_project_file "${VC_PROJECT_FILE}.cmake")
set(_all_sources)
cmake_path(GET _project_file PARENT_PATH _project_path)
if ("${_project_path}" STREQUAL "")
set(_project_path "./")