Skip to content

Instantly share code, notes, and snippets.

@kmcallister
kmcallister / scope_triangle.py
Created June 14, 2017 22:40
oscilloscope sierpinski triangle
#!/usr/bin/env python
import sys
import struct
import random
funcs = [
lambda (x, y): (x/2.0, y/2.0 + 1.0),
lambda (x, y): (x/2.0 - 1.0, y/2.0),
lambda (x, y): (x/2.0 + 1.0, y/2.0),
@kmcallister
kmcallister / Bar.hs
Created June 12, 2017 02:22
Haskell module cycle
module Bar where
import Foo
@kmcallister
kmcallister / .travis.yml
Created June 6, 2017 21:00
travis setup for clippy (untested)
language: rust
rust:
- stable
- beta
- nightly
script:
- cargo build --verbose
- cargo test --verbose
- if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then cargo install clippy && cargo clippy; fi
@kmcallister
kmcallister / d4.rs
Last active April 8, 2018 02:09
d4 for STM32F4-Discovery
#![feature(used)]
#![no_std]
#[macro_use]
extern crate cortex_m;
extern crate cortex_m_rt;
extern crate stm32f40x;
use core::u16;
use stm32f40x::{GPIOA, GPIOD, RCC, TIM7};
@kmcallister
kmcallister / gdb.txt
Created May 24, 2017 22:38
cortex-m issues
$ arm-none-eabi-gdb -x ~/.gdbinit target/thumbv7em-none-eabi/debug/examples/hello -x .gdbinit
GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20151217-cvs
[snip]
Reading symbols from target/thumbv7em-none-eabi/debug/examples/hello...done.
[snip]
0x08000574 in cortex_m::exception::default_handler<cortex_m::exception::BusFault> (_token=...)
at /home/keegan/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.2.7/src/exception.rs:176
176 asm!("mrs r0, MSP
semihosting is enabled
Loading section .text, size 0xd78 lma 0x8000000
keegan@marasmius ~/azurescens$ NDK_HOME=~/android/android-ndk-r14b ANDROID_HOME=~/android cargo apk
Cargo-Apk: Compiling android_native_app_glue.c
Cargo-Apk: Compiling injected-glue
Cargo-Apk: Compiling injected-glue
Cargo-Apk: Compiling glue_obj
Cargo-Apk: Compiling crate
Compiling azurescens v0.1.0 (file:///home/keegan/azurescens)
Finished dev [unoptimized + debuginfo] target(s) in 5.24 secs
Cargo-Apk: Invoking ant
Error executing ["ant", "debug"]
time: 0.002; rss: 46MB parsing
time: 0.000; rss: 46MB recursion limit
time: 0.000; rss: 46MB crate injection
time: 0.000; rss: 46MB plugin loading
time: 0.000; rss: 46MB plugin registration
time: 0.108; rss: 114MB expansion
time: 0.000; rss: 114MB maybe building test harness
time: 0.000; rss: 114MB maybe creating a macro crate
time: 0.000; rss: 114MB checking for inline asm in case the target doesn't support it
time: 0.000; rss: 114MB early lint checks
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ "cargo" "build" "--example" "hello" "--verbose"
Fresh r0 v0.2.1
Fresh vcell v0.1.0
Fresh cortex-m-semihosting v0.1.3
Fresh volatile-register v0.2.0
Fresh cortex-m v0.2.4
Fresh cortex-m-rt v0.2.0
Compiling cortex-m-quickstart v0.1.1 (file:///home/keegan/rust-embedded/cortex-m-quickstart)

Rescue fries

Ingredients

One box of take-out French fries that weren't that good when I ordered them and now have been sitting in the fridge 5 days and are hella dried out

Fair amount of heavy cream

Some chopped garlic (mine was already on the fries)

Traceback (most recent call last):
File "./rtdex_build.py", line 55, in <module>
ffibuilder.compile(verbose=True)
File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 665, in compile
compiler_verbose=verbose, **kwds)
File "/usr/lib/python2.7/dist-packages/cffi/recompiler.py", line 1441, in recompile
updated = make_c_source(ffi, module_name, preamble, c_file)
File "/usr/lib/python2.7/dist-packages/cffi/recompiler.py", line 1348, in make_c_source
return _make_c_or_py_source(ffi, module_name, preamble, target_c_file)
File "/usr/lib/python2.7/dist-packages/cffi/recompiler.py", line 1328, in _make_c_or_py_source