Skip to content

Instantly share code, notes, and snippets.

matt venn mattvenn

Block or report user

Report or block mattvenn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View plot_bw_fft.py
import numpy as np
import matplotlib.pyplot as plt
import glob
Fs = 32000000 / 16 # sampling rate
Ts = 1.0/Fs # sampling interval
def load(filename):
y = []
x = []
View instruction_filter.py
#!/usr/bin/python3
import sys
instructions = [ 'Sync', 'Call', 'Return', 'Execute', 'LoadCode', 'LoadCoeff0', 'LoadCoeff1', 'ContinueLoad', 'SetVBP', 'AddVBP', 'SetLBP', 'AddLBP', 'SetSBP', 'AddSBP', 'SetCBP', 'AddCBP', 'Store', 'Store0', 'Store1', '---', 'ReLU', 'ReLU0', 'ReLU1', '---', 'Save', 'Save0', 'Save1', '---', 'LdSet', 'LdSet0', 'LdSet1', '---', 'LdAdd', 'LdAdd0', 'LdAdd1', '---', '---', '---', '---', '---', 'MACC', 'MMAX', 'MACCZ', 'MMAXZ', '---', 'MMAXN' ]
def main(argv0, *args):
fh_in = sys.stdin
fh_out = sys.stdout
# Repeat ...
while True:
View gist:ed98fa97ea970bf7fe7db6dc99eb8244
ThinkPad:497 [(HEAD detached at 30455092c)]: cmake -L ../../
-- Kicad install dir: </usr/local>
-- Check for installed GLEW -- found
-- Boost version: 1.62.0
-- Check for installed Python Interpreter -- found
-- Python module install path: lib/python2.7/dist-packages
-- wxPython version 3.0 found.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created
-- S3DSG version: 2.0.0
View gist:e34e66069409dc2bad3997e82385c71f
[ 47%] Building CXX object 3d-viewer/3d_cache/sg/CMakeFiles/kicad_3dsg.dir/scenegraph.cpp.o
/home/matt/kicad-build/kicad/3d-viewer/3d_cache/sg/scenegraph.cpp: In member function ‘bool SCENEGRAPH::Prepare(const dmat4*, S3D::MATLIST&, std::vector<SMESH>&)’:
/home/matt/kicad-build/kicad/3d-viewer/3d_cache/sg/scenegraph.cpp:744:75: error: no matching function for call to ‘rotate(double&, glm::dvec3)’
glm::dmat4 rM = glm::rotate( rotation_angle, glm::dvec3( rX, rY, rZ ) );
^
In file included from /usr/include/glm/gtc/quaternion.hpp:434:0,
from /usr/include/glm/gtc/epsilon.inl:5,
from /home/matt/kicad-build/kicad/3d-viewer/3d_cache/sg/scenegraph.cpp:29:
/usr/include/glm/gtc/quaternion.inl:557:33: note: candidate: template<class T, glm::qualifier Q> glm::tquat<T, Q> glm::rotate(const glm::tquat<T, Q>&, const T&, const glm::vec<3, T, Q>&)
GLM_FUNC_QUALIFIER tquat<T, Q> rotate(tquat<T, Q> const& q, T con
@mattvenn
mattvenn / gist:2aa864092b7ea2105d8d8b764ed3c4d0
Created May 19, 2018
ubuntu kicad 18.04 LTS install notes
View gist:2aa864092b7ea2105d8d8b764ed3c4d0
mkdir kicad-build
cd kicad-build
git clone -b master https://git.launchpad.net/kicad
cd kicad/
git checkout 3045509
mkdir -p build/release
cd build/release/
sudo apt install cmake
sudo apt install build-essential
@mattvenn
mattvenn / install.md
Created May 19, 2018
install kicad from source on ubuntu 18.04 LTS
View install.md

kdir kicad-build cd kicad-build git clone -b master https://git.launchpad.net/kicad cd kicad/ git checkout 3045509 mkdir -p build/release cd build/release/

sudo apt install cmake sudo apt install build-essential

@mattvenn
mattvenn / i2c-plot.py
Created Feb 5, 2018
plot i2c read variance
View i2c-plot.py
import serial
import re
"""
i2c data captured with sigrok-cli:
sigrok-cli -C 0,1 -c "samplerate=500k:voltage_threshold=1.8-1.8:continuous=on" --driver=dreamsourcelab-dslogic --samples 10M -P i2c:sda=1:scl=0 -A i2c=address-write --protocol-decoder-samplenum > data.raw
"""
samplerate = 1.0/500e3
View gist:930590aabbb46beba6a9306312d3e620

gdb + avarice + debugwire on attiny88

enable debugwire

enable with avrdude (fuse for attiny88):

avrdude -c dragon_isp -P usb -p attiny88 -v -U hfuse:w:0xd9:m

compilation

View debounce.py
samp = [1 ,1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
state = 1
db0 = 0
db1 = 0
print("samp = button state 0 is pressed")
print("delta = samp ^ state difference between sample and state")
print("db0 = ~(db0) & delta first bit of 2 bit counter")
print("db1 = (db1 ^ db0) & delta second bit of 2 bit counter")
print("changes = ~(~delta | db0 | db1) if a change has happened")
print("state = state ^ changes state of the debouncer")
@mattvenn
mattvenn / blackice.md
Last active Feb 21, 2018
upload firmware to mystorm blackice board
View blackice.md
You can’t perform that action at this time.