Skip to content

Instantly share code, notes, and snippets.

@RickKimball
RickKimball / ws2811_utils.S
Last active December 20, 2015 11:19
lpc8xx lpc810 ws2811/ws2812 driver routines in cortex-m0+ gnu assembler
@-------------------------------------------------------------------------------
@ ws2811_utils.S - write pixel data to ws2811 leds
@-------------------------------------------------------------------------------
@
@ lpc810 cortex-m0+ ARM ASM routine for streaming pixels data
@
@ assumes interrupts are disabled when called
@ assumes 24MHz system clock, flash wait state set to 0
@ assumes P0_2 configured as OUTPUT connected to ws2811 DIN pin
@
@RickKimball
RickKimball / msp430-stdlst.sh
Created October 28, 2013 21:50
msp430-stdlst - create standard listing files
#!/bin/bash
#-------------------------------------------------------------------------
# Desc: msp430-stdlst - generate standard asm listings, mixed c++/asm and
# instruction cycle counts. This code assumes nake430util is in
# your PATH.
#
# Created: June 12, 2012
# Author: rick@kimballsoftware.com
# Date: 03-03-2012
# Version: 1.0.1
@RickKimball
RickKimball / build-mspgcc.sh
Created December 28, 2011 20:27
msp430gcc toolchain fetcher/builder script
#!/usr/bin/env bash
# $Id: build-mspgcc 70 2011-11-05 19:40:36Z ice $
# 2012-02-04 kimballr - modified for latest FSF directory and
# sourceforge patch file name changes
# 2012-03-13 kimballr - added patches
#
# download, build and install GCC toolchain for MSP430
#
# prerequisites
# - bash
@RickKimball
RickKimball / Makefile
Last active March 22, 2016 20:22
tiny preemptive msp430 tasker from Tony Philipsson ported to msp430-gcc
#--------------------------------------------------------------------
# Makefile - for tiny msp430 preemptive kernel
TARGET = tinyos.elf
# point this to where your CCS is installed
CCS_PATH =? $(HOME)/ti/ccsv6
#ARCH ?= msp430-elf-
ARCH ?= msp430-
@RickKimball
RickKimball / delay.c
Created January 19, 2012 22:02
msp430-gcc delay using inline asm
/**
* void delay(uint16 cnt) - using cpu cycle counting busy loop
*
* Sit in a tight loop until delayCycles instructions cycles
* have occurred. Not very power friendly. Not very interrupt
* friendly. In fact, you should disable interrupts before
* calling this function to insure accurate results.
*
* Note: minimum of 20 cycles
*
This file has been truncated, but you can view the full file.
#include "libmaple/ring_buffer.h"
#include "streaming.h"
uint8_t buffer[32];
ring_buffer message_buffer = { buffer, 0, 0, 32 - 1 };
void queue_message(const char *str) {
while (*str) {
GPIOC_BASE->BRR = (1 << 13); // time function using gpio toggle
#include "ringbuffer_e.h"
#include "streaming.h"
uint8_t buffer[32];
ring_buffer message_buffer = { buffer, 0, 0, sizeof(buffer) };
void queue_message(const char *str) {
while (*str) {
GPIOC_BASE->BRR = (1 << 13); // time function using gpio toggle
@RickKimball
RickKimball / dwt_timer.h
Last active September 6, 2016 05:33
delay_cycles via DWT cortex-m3 registers
/*
* dwt_timer.h
*
* Created on: Jun 15, 2015
* Author: kimballr
*/
#ifndef DWT_TIMER_H_
#define DWT_TIMER_H_
@RickKimball
RickKimball / _reset_snippet.c
Last active October 26, 2016 19:26
msp432 startup code
/* This is the code that gets called when the processor first starts execution */
/* following a reset event. Only the absolutely necessary set is performed, */
/* after which the application supplied entry() routine is called. Any fancy */
/* actions (such as making decisions based on the reset cause register, and */
/* resetting the bits in that register) are left solely in the hands of the */
/* application. */
void resetISR(void) {
#ifdef WDTHOLD
WDTCTL = WDTPW + WDTHOLD;