Skip to content

Instantly share code, notes, and snippets.

View raldone01's full-sized avatar

raldone01

View GitHub Profile
@raldone01
raldone01 / timings_fmc_lcd_NT35510.py
Created November 15, 2024 15:34
STM32 FMC Timings calculator
from time import perf_counter_ns
# Derived from https://github.com/godunko/scd40-sandbox/blob/893654c479f64c9078e839a6242d53695bddb9d3/documentation/NOTES.md?plain=1#L8
# Thank you for doing the hard work, godunko!
# Clock definitions
HCLK = 216_000_000 # 216 MHz in Hz
FMCCLK = HCLK / 2 # FMC clock derived from HCLK
T_FMCCLK = 1 / FMCCLK # FMC clock period in seconds
T_FMCCLK_ns = T_FMCCLK * 1e9 # FMC clock period in nanoseconds
@raldone01
raldone01 / multivid.py
Created October 9, 2023 05:54
multivid.py
import argparse
import cv2
import numpy as np
import os
import sys
import logging # Step 2: Import the logging library
# Initialize logging
logging.basicConfig(level=logging.INFO)
@raldone01
raldone01 / CMakeLists.txt
Created September 15, 2023 21:30
Fast LCM and GCD
cmake_minimum_required(VERSION 3.10.2)
project(c_lcm)
set(CMAKE_CXX_STANDARD 17)
add_executable(c_lcm main.cpp)
@raldone01
raldone01 / chargo-check.png
Last active June 25, 2022 20:54
Rustc: Consider restricting Self: Sized, Self: Sized,
chargo-check.png
@raldone01
raldone01 / Parent.kt
Last active August 29, 2019 18:14
I like extension functions
interface Parent {
/**
* This property is null when this isn't attached to anything.
*/
val parent: Parent?
val children: List<Parent>
/**
* @throws NoMutationAllowedException
timespec timespecDiff(timespec start, timespec stop) {
timespec ret;
ret.tv_sec = stop.tv_sec - start.tv_sec;
if(start.tv_nsec > stop.tv_nsec) {
ret.tv_nsec = 1000000000 - start.tv_nsec + stop.tv_nsec;
ret.tv_sec--;
} else
ret.tv_nsec = stop.tv_nsec - start.tv_nsec;
return ret;
}