Skip to content

Instantly share code, notes, and snippets.

@standarddeviant
standarddeviant / gr_live_window.jl
Last active October 20, 2018 14:59
Simulation of live plotting from received packets using GR.jl in Julia
# gr_live_window.jl
using GR
function keyboard_channel()
# allow 'q' and <ENTER> sequentially pressed on the keyboard to break the loop
count = 0
kb2loop = Channel(10)
@async while true
kb_input = readline(STDIN)
# maybe we hit an error or something got messed up...
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@standarddeviant
standarddeviant / dsp_plot.jl
Last active August 28, 2018 05:00
Prototype of DSP.jl aware plotting via RecipesBase.jl
# using Plots
# theme(:juno)
# pyplot(size=(900, 300))
# plot(randn(10), m=:o)
using DSP
PlottableFilter = Union{FilterCoefficients}
f = digitalfilter(
Lowpass(10, fs=40),
Butterworth(8)
@standarddeviant
standarddeviant / plot_for_FilterCoefficients.jl
Last active May 24, 2018 22:46
Plotting function for FilterCoefficient types from DSP.jl
import Plots
function Plots.plot(fc::FilterCoefficients, w=linspace(0, pi, 500); fs=2,
domag=true, dophase=true,
doimp=false, impn=500,
dostep=false, stepn=500, size=(800, 600))
# calculate plottable vectors
if domag || dophase
h = freqz(fc, w)
end
if doimp
@standarddeviant
standarddeviant / isr_test.ino
Last active April 19, 2018 15:03
Trying to figure out where how to user interrupts safely on a a MKRZERO
#include <SD.h>
// START https://mcuoneclipse.com/2014/01/26/entercritical-and-exitcritical-why-things-are-failing-badly/
#define CpuCriticalVar() uint8_t cpuSR
#define CpuEnterCritical() \
do { \
asm ( \
"MRS R0, PRIMASK\n\t" \
@standarddeviant
standarddeviant / build_and_run.sh
Last active January 18, 2018 04:21
Usable julia embedding example (julia 0.6.2)
# 0.6.2 in the home directory
#export JULIA_DIR="$HOME/julia-d386e40c17/"
#export JULIA_HOME="$JULIA_DIR/bin"
echo "JULIA_DIR = $JULIA_DIR"
echo "JULIA_HOME = $JULIA_HOME"
#
gcc -o wizbang -fPIC -I$JULIA_DIR/include/julia \
-std=gnu99 \
-L$JULIA_DIR/lib -L$JULIA_DIR/lib/julia \
# nargoutTest.jl
function nargoutTest(a,b)
@show a, b
return "outp1", "outpTWO"
end