Skip to content

Instantly share code, notes, and snippets.

@RickKimball
RickKimball / main.cpp
Last active August 29, 2015 13:57
ws281x driver using USCI SPI, with updated asm code for msp430-elf-gcc
/*
* main.cpp - msp430-elf-gcc ws281x USCI SPI driver using inline asm
*
* Author: kimballr
* Date: Dec 28, 2012
* Version: 0.0002
*
* 2014-09-29 rrk - updated for both msp430-elf-gcc and msp430-gcc
* P1.0 - CS - N/A not used, however it is still useful as an oscilloscope trigger
* P1.7 - MOSI -> WS281x DIN
@RickKimball
RickKimball / buildit.sh
Last active August 29, 2015 14:01
weaklinkings
#!/bin/bash
set -x
set -e
#export LU="-Wl,-uTimer0_A0_Handler -Wl,-umain"
export CFLAGS="-I. -mmcu=msp430f5529 -Os -fdata-sections -ffunction-sections"
export LU="-Wl,-uTimer0_A0_Handler,-umain,--gc-section"
export LDFLAGS="-L . -lintr"
@RickKimball
RickKimball / Makefile
Last active August 29, 2015 14:01
another ringbuffer
all: main
main: main.cpp
gcc -std=c++0x -Os -g -Wall -o $@ $<
clean:
rm -f main
test:
./main
@RickKimball
RickKimball / iomacros.h
Created August 22, 2014 14:19
msp430-elf-gcc - 4.9.1 alternative iomacros.h
/*******************************************************************************
* iomacros.h - hacked version to work with .S files properly
*
* Copyright (C) 2003-2013 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
@RickKimball
RickKimball / ActiveLowLED.h
Last active August 29, 2015 14:20
simple blink
/*
* ActiveLowLED - class for leds that light up when they are grounded
*/
#include <Arduino.h>
#pragma once
class ActiveLowLED {
private:
const int _pin;
int _initialized;
@RickKimball
RickKimball / issue54.patch
Created May 28, 2015 14:30
issue #54 patch
diff --git a/STM32F1/cores/maple/ext_interrupts.h b/STM32F1/cores/maple/ext_interrupts.h
index ce1ca03..a406868 100644
--- a/STM32F1/cores/maple/ext_interrupts.h
+++ b/STM32F1/cores/maple/ext_interrupts.h
@@ -106,7 +106,7 @@ void detachInterrupt(uint8 pin);
*
* @see noInterrupts()
*/
-static __always_inline void interrupts() {
+static inline __always_inline void interrupts() {
@RickKimball
RickKimball / runfast.c
Created May 4, 2011 04:59
msp430g2231 - use external square wave from ATTiny @ 12 MHZ as LFXT1 clock
//***********************************************************
// runfast.c - Using 12MHZ external square wave clock as LFXTCLK
// source MCLK/SMCLK from 12MHZ wave and blink led
// at 60Hz
//
// Use an external clock ( I'm using an attiny running at 12.00 MHZ
// with the CLKOUT fuse enabled ) as the MCLK/SMCLK for the MSP430.
// I've been told you could also use an external oscillator like an
// ECS-100A-160. I ordered some of these to verify.
//
@RickKimball
RickKimball / Makefile
Created May 12, 2011 21:07
Simple USCI UART Test code for msp430-gcc uniarch and msp430g2553 hardware
#
# Makefile - usci_serial
#
# License: Do with this code what you want. However, don't blame
# me if you connect it to a heart pump and it stops. This source
# is provided as is with no warranties. It probably has bugs!!
# You have been warned!
#
# Author: Rick Kimball
# email: rick@kimballsoftware.com
@RickKimball
RickKimball / RingBuffer.h
Created May 24, 2011 16:20
fabooh core sample code
/*
* RingBuffer.h - template for a circular buffer
*
* License: Do with this code what you want. However, don't blame
* me if you connect it to a heart pump and it stops. This source
* is provided as is with no warranties. It probably has bugs!!
* You have been warned!
*
* Author: Rick Kimball
* email: rick@kimballsoftware.com