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 / lpc1114.cfg
Last active July 16, 2019 03:48
configuration files for lpc812 using SWD from an stlink-v2 discovery board
#-----------------------------------------
# NXP lpc1114fn23 Cortex-M0 32k flash, 4k ram
set CHIPNAME lpc1114
set CPUTAPID 0x0BB11477
set CPUROMSIZE 0x8000
set CPURAMSIZE 0x1000
# After reset the chip is clocked by the ~12MHz internal RC oscillator.
# When board-specific code (reset-init handler or device firmware)
@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 / 50baud.c
Last active December 30, 2017 22:36
msp430 example showing timer used to periodically send 50 baud async data
/*
* 50baud.c - example of sending 50 baud async serial output on P1.1
* code uses timer sourced from VLO and sleeps between reports.
*
* P1.0 - optionally output ACLK for measurement of VLO
* P1.1 - 50 baud async serial output
* P1.6 - indicator led, on during serial transmission
*
* TIMER0 - continuous up mode sourced with ACLK (VLO)
* TIMER0_A0 - 50 baud ISR enabled and disable for 8-N-1 transmission
@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 / signedtest.c
Created February 15, 2013 01:34
problem child for msp430-gcc 4.6.3 with patches
/**
* signedtest.c - this fails to output int8_t values properly when optimized with -Os
*
* Compiled like this:
*
* $ msp430-gcc -mmcu=msp430g2553 -DF_CPU=16000000 -Os -Wall \
* -Wno-main -g -mdisable-watchdog -fdata-sections -ffunction-sections \
* -Wl,--gc-sections signedtest.c
*
* $ mspdebug rf2500 "prog a.out"
@RickKimball
RickKimball / asciitable.ino
Last active December 12, 2015 10:19
sw_serial_t - blocking software only cycle counting msp430 serial routines for Energia
/*
* aciitable - example of using the blocking sw_serial_t template
*/
#include "streaming.h" /* pull in insertion operator overloads */
#include "sw_serial.h"
// typedefs for software only rx/tx using software pin settings * J3 default jumper settings
// this is a good setting for the g2452 and g2231
sw_serial_t<9600, SS_P1_2, SS_NO_PIN> swserial; // HW jumper version TX=P1.2, RX=NOT CONNECTED
@RickKimball
RickKimball / logo.inc
Last active December 12, 2015 02:59
xbmto5110 - convert xbm files to c structures usable with nokia 5110 lcd displays and oPossum nokia5110 template
/*
* lp_logo - nokia 5110 style bitmap
*
* Generated by xbmto5110 on Feb 3 2013 14:19:20
* Note: visualize the '1' and '0's rotated 90 degrees counterclockwise
*/
static const unsigned char lp_logo[] = {
/* width, height/8 */
56,48/8,
@RickKimball
RickKimball / test.cpp
Last active December 11, 2015 07:18
forum comment
uint32_t max31855::memory_read(void)
{
uint32_t mask = 0x80000000;
uint32_t data = 0;
digitalWrite(_cs,LOW);
do {
digitalWrite(_sclk, HIGH);
if (digitalRead(_so)) {
data |= mask;
@RickKimball
RickKimball / startup_gcc.c diff
Created December 22, 2012 20:49
Energia - Timer based blink
$ diff linux/work/hardware/lm4f/cores/lm4f/startup_gcc.c ../hardware/lm4f/cores/lm4f/startup_gcc.c
71d70
< __attribute__((weak)) extern void Timer0IntHandler(void) {}
123c122
< Timer0IntHandler, // Timer 0 subtimer A
---
> IntDefaultHandler, // Timer 0 subtimer A
$