Skip to content

Instantly share code, notes, and snippets.

Rick Kimball RickKimball

View GitHub Profile
@RickKimball
RickKimball / nco.cpp
Last active Oct 17, 2017
NCO c++ template
View nco.cpp
// vim: set ts=2 sw=2 expandtab list
/*
* File: nco.cpp
* Description: NCO c++ template and testdriver
*
* Author: rick kimball
*
* g++ -DDEBUG -Wall -Os -g nco.cpp -o nco
*/
@RickKimball
RickKimball / print_64t.ino
Last active Oct 17, 2017
arduino int64_t streaming serial print example
View print_64t.ino
// sketch_oct16a
// printll provides printing for int64_t uint64_t types using Streaming..
// Rick Kimball
#include "Streaming.h"
char * _print_base(char *buf, uint64_t n, int base) {
char *str = &buf[(64+1) - 1]; // handle printing bits
*str = '\0'; // work from least significant digit to most
@RickKimball
RickKimball / Makefile
Last active Jan 28, 2018
stm32duino Makefile for adding custom boards.
View Makefile
# STM32F1/Makefile - provide a way to use a custom boards.txt
#
#
.phony: all checkout clean
all: boards.txt
checkout:
git checkout boards.txt
boards.txt:
View w1_poll.sh
#!/bin/bash
# read the w1-temp values
# put each line1 and 2 into variables
# parse and see if it is ready
# if so read the raw value and round it to 2 decimals
read_sensor()
{
SENSOR_FILE=$1
local __celsius_raw=$2
@RickKimball
RickKimball / 60Hz.cpp
Last active Nov 28, 2016
msp430fr5969 - 60Hz Sine Wave using PWM
View 60Hz.cpp
/*
* 60Hz.c - generate a 60Hz PWM sine wave msp430frxxxx
*
* This code written for msp430-elf-gcc
*
* Note: make sure to compile with -ffixed-R6 -ffixed-R7.
*/
#include <msp430.h>
#include <inttypes.h>
View edogaldo_example.ino
#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
View maple_example.ino
#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
View ringbuffer.h
/*
ringbuffer.h - fabooh version of the ringbuffer_t c++ template
Desc: A c++ template class implementing a lock free fixed sized ringbuffer
with arbitrary types. The push and pop methods implement adding and
removing items. The size and capacity methods return the unread
and max number of items in the buffer.
This version has been optimized for embedded single core 32 bit
mcus. It doesn't disable or enable any interrupts. It is safe
@RickKimball
RickKimball / Makefile
Last active Mar 22, 2016
tiny preemptive msp430 tasker from Tony Philipsson ported to msp430-gcc
View Makefile
#--------------------------------------------------------------------
# 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-
You can’t perform that action at this time.