Skip to content

Instantly share code, notes, and snippets.

View xdsopl's full-sized avatar
😑
Does not compute

Ahmet Inan xdsopl

😑
Does not compute
View GitHub Profile
@xdsopl
xdsopl / cauchy.cc
Last active April 19, 2023 13:59
Generating and inverting Cauchy matrices using Galois field values
#include <iostream>
#include "galois_field.hh"
#if 0
typedef CODE::GaloisField<8, 0b100011101, uint8_t> GF;
#else
typedef CODE::GaloisField<16, 0b10001000000001011, uint16_t> GF;
#endif
typedef typename GF::ValueType ValueType;
typedef typename GF::IndexType IndexType;
@xdsopl
xdsopl / latching_on_off_using_NE555.asc
Last active March 3, 2023 13:37
Latching On Off switch using the NE555

Version 4 SHEET 1 1048 680 WIRE 48 -64 -224 -64 WIRE 464 -64 48 -64 WIRE 800 -64 464 -64 WIRE 992 -64 800 -64 WIRE -224 -16 -224 -64 WIRE 576 -16 80 -16 WIRE 672 -16 576 -16 WIRE 800 -16 800 -64

@xdsopl
xdsopl / pdm.c
Created December 29, 2021 13:05
PDM MEMS microphone to 16 bit at 16 kHz PCM using a 2 MHz crystal oscillator and a logic analyzer
/*
2 MHz clock goes to the PDM MEMS microphone and channel 0 of the logic analyzer.
The logic analyzer needs at least a 6 MHz sample rate or three times the clock rate.
Data signal from the microphone goes to channel 4 of the logic analyzer.
Tested using a MP34DT01-M with select connected to ground.
compile:
gcc -Ofast -Wall -o pdm pdm.c
stream to speakers:
@xdsopl
xdsopl / Makefile
Created August 20, 2021 15:19
Test bench for doing the Short-time Fourier transform using channelizer techniques
CXXFLAGS = -std=c++11 -W -Wall -Ofast -fno-exceptions -fno-rtti -march=native -I../dsp
CXX = clang++ -stdlib=libc++
#CXX = g++
testbench: testbench.cc
$(CXX) $(CXXFLAGS) $< -o $@
.PHONY: clean
@xdsopl
xdsopl / Makefile
Last active May 24, 2021 09:12
Run length encoding of mostly zero bits
CXXFLAGS = -std=c++11 -W -Wall -Ofast -fno-exceptions -fno-rtti -march=native
CXX = clang++ -stdlib=libc++
#CXX = g++
.PHONY: all
all: testbench
test: testbench
@xdsopl
xdsopl / Makefile
Last active May 24, 2021 08:37
Variable length integer encoding and run length encoding
CXXFLAGS = -std=c++11 -W -Wall -Ofast -fno-exceptions -fno-rtti -march=native
CXX = clang++ -stdlib=libc++
#CXX = g++
.PHONY: all
all: testbench
test: testbench
@xdsopl
xdsopl / play.sh
Last active April 8, 2021 09:57
Playing PCM sound over RS232, RS422, RS485 or UART TX pin using pulse width modulation with noise shaping
#! /bin/bash
# FT232RL:
# baud=500000 idle=0
baud=1000000 idle=0
# baud=2000000 idle=0
# baud=3000000 idle=0
# CP210X:
# baud=500000 idle=1
@xdsopl
xdsopl / fmdemod.c
Last active October 29, 2020 17:05
Multiplier-less fixed-point FM demodulation
/*
Multiplier-less fixed-point FM demodulation
Copyright 2020 Ahmet Inan <inan@aicodix.de>
*/
#include <stdio.h>
int int_real(int x)
{
@xdsopl
xdsopl / letters2morse
Last active August 27, 2020 12:10
convert letters to and from morse code
#! /bin/bash
sed '
s/ /\//g;
s/A/ .-/g;
s/B/ -.../g;
s/C/ -.-./g;
s/D/ -../g;
s/E/ ./g;
s/F/ ..-./g;
@xdsopl
xdsopl / .gitignore
Last active August 5, 2020 14:49
Test bench for ordered statistics decoding
.*.swp
testbench