Skip to content

Instantly share code, notes, and snippets.

@mdaffin
mdaffin / arduino.rules
Created October 6, 2012 15:32
Arduino/xbee udev rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0001", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="ee18", GROUP="users", MODE="0666"
@mdaffin
mdaffin / a1_test.py
Last active December 22, 2015 02:48
A test harness for the first assignment on the learning to program course: https://class.coursera.org/programming1-002/class/index
import unittest
from a1 import *
class TestA1Functions(unittest.TestCase):
def test_seconds_difference(self):
self.assertEqual(seconds_difference(1800.0, 3600.0), 1800.0)
self.assertEqual(seconds_difference(3600.0, 1800.0), -1800.0)
self.assertEqual(seconds_difference(1800.0, 2160.0), 360.0)
self.assertEqual(seconds_difference(1800.0, 1800.0), 0.0)
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/home/james/sketchbook/libraries/Blink /tmp/build4026121571324884541.tmp/sketch_sep05a.cpp -o /tmp/build4026121571324884541.tmp/sketch_sep05a.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/home/james/sketchbook/libraries/Blink -I/home/james/sketchbook/libraries/Blink/utility /home/james/sketchbook/libraries/Blink/Blink.cpp -o /tmp/build4026121571324884541.tmp/Blink/Blink.cpp.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -c -g -O
@mdaffin
mdaffin / layout_decoupled_exported.xml
Created February 11, 2015 22:51
Star citizen layouts
<ActionMaps version="1">
<CustomisationUIHeader label="decopled" description="" image="">
<devices>
<keyboard instance="1"/>
</devices>
</CustomisationUIHeader>
<options type="keyboard" instance="1"/>
<actionmap name="spaceship_movement">
<action name="v_decoupled_strafe_up">
<rebind defaultInput="r" device="keyboard" input="w"/>
-- Basic Settings
-- cl_fov = 90
-- pl_movement.power_sprint_targetFov = 90
-- r_DrawNearFoV = 90
Con_Restricted = 0
r_Fullscreen = 0
r_FullscreenPreemption = 1
r_FullscreenWindow = 1
-- Anti-Aliasing
@mdaffin
mdaffin / consul-install.sh
Created June 30, 2015 11:36
consul install script
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
function required() {
hash "${1}" 2>/dev/null || { echo >&2 "${1} is required but is not installed. Aborting."; exit 1; }
}
required wget
required unzip
@mdaffin
mdaffin / .gitignore
Created January 13, 2016 12:29
bare metal assembly on the teensy 3.1
*.swp
*.elf
*.hex
*.o
@mdaffin
mdaffin / .gitignore
Last active January 1, 2024 16:21
bare metal assembly on the teensy 3.1
*.swp
*.elf
*.hex
*.o

C on the teensy 3.1

An example of writing pure c on the teensy 3.1.

Prerequisites

You will need the C compiler, linker and objcopy from the arm-none-eabi toolkit:

  • arm-none-eabi-gcc
  • arm-none-eabi-ld
  • arm-none-eabi-objcopy
@mdaffin
mdaffin / main.rs
Created January 24, 2016 11:56
A bare metal example of blink written in rust for the teensy 3.1
#![feature(lang_items,no_std,core_intrinsics,asm,start)]
#![no_std]
#![crate_type="staticlib"]
use core::intrinsics::{volatile_store};
#[lang="stack_exhausted"] extern fn stack_exhausted() {}
#[lang="eh_personality"] extern fn eh_personality() {}
#[lang="panic_fmt"]
#[no_mangle]