Skip to content

Instantly share code, notes, and snippets.

@RickKimball
RickKimball / readme.md
Last active November 26, 2018 09:34
ws281x driver using DMA and MSP430F5529 (tested on ws2811 and ws2812b aka neo pixels)

This code is used to drive a ws281x strip using SPI driven by DMA on an msp430f5529.

@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 / gpioblnk.ino
Last active July 24, 2019 07:33
c++ template blink using register level gpio access
// more fun with c++ classes and templates
// http://www.stm32duino.com/viewtopic.php?f=18&t=303
class GPIOPort :
public gpio_reg_map {
public:
void high(const uint32_t pin) {
BSRR = 1 << pin;
}
void low(const uint32_t pin) {
BRR = 1 << pin;
@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 / 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 / _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;
@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 / 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 / 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"