Skip to content

Instantly share code, notes, and snippets.

View spirilis's full-sized avatar

Eric spirilis

  • Maryland, USA
View GitHub Profile
#include <Enrf24.h>
#include <nRF24L01.h>
#include <SPI.h>
// Parameters
#define RADIO_CHANNEL 10
#define RADIO_SPEED 250000
#define DEVICE_ID 0x08
#define SLEEP_INTERVAL 120 // seconds
@spirilis
spirilis / highmem.c
Last active August 29, 2015 14:00
MSP430 20-bit read/write from 16-bit-only compiler
/* Public domain software
* MSP430 20-bit data copy runnable from within a 16-bit-only compiler (e.g. mspgcc 4.6.3)
*/
#include <msp430.h>
#include <stdint.h>
void highmem_write(uint32_t dstaddr, void *srcaddr, uint16_t len)
{
// Copy <len> bytes in units of 2-bytes per transfer from srcaddr[] to dstaddr[]
len &= ~1;
@spirilis
spirilis / highmem_inline.h
Last active August 29, 2015 14:00
MSP430 20-bit read/write from 16-bit-only compiler; inline-able form
/* Public domain software */
#ifndef HIGHMEM_INLINE_H
#define HIGHMEM_INLINE_H
#include <msp430.h>
#include <stdint.h>
__attribute__((always_inline))
inline static void highmem_write(uint32_t dstaddr, void *srcaddr, uint16_t len)
{
@spirilis
spirilis / RadioBot.ino
Created July 11, 2014 17:15
IRC of Things bot - IrcBot, Enrf24, Pkt on Tiva-C Connected LaunchPad
/* RadioBot - IRC bot with Radio support */
#include <IrcBot.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <Enrf24.h>
#include <SPI.h>
#include <Pkt.h>
byte ourMac[] = { 0x52, 0x54, 0xFF, 0xFF, 0xFF, 0x01 };
@spirilis
spirilis / Wolv_Lightning_Logger.ino
Last active August 29, 2015 14:05
Current revision: MSP430 Wolverine logging system for AS3935 Franklin Lightning Sensor
/* Wolverine Lightning Sensor Logger
*
* A sensor logging application for the TI MSP430 Wolverine which utilizes
* the Austria Microsystems AS3935 Franklin Lightning Sensor to sense lightning
* strikes and log them, timestamped, into the Wolverine's FRAM.
*/
#include <SPI.h>
#include <Franklin.h>
#include <RTC_B.h>
#include <string.h>
@spirilis
spirilis / flash.c
Last active August 29, 2015 14:05
MSP430F5xxx infomem flasher
/* Simple F5xxx Flash Erase/Write primitives
* 2014 Eric Brundick <spirilis@linux.com>
*/
#include <msp430.h>
#include <stdint.h>
#include <stdbool.h>
#include "flash.h"
int flash_erase_info(void *loc)
{
@spirilis
spirilis / dmx512.c
Created September 1, 2014 14:51
MSP430F5xxx infomem flash example
#include <msp430.h>
#include <stdint.h>
#include "flash.h"
#define SEG_INFOB __attribute__((section(".infob")))
#define DMX_PASSWORD_VALID ((uint16_t) 0xFEF5)
uint16_t SEG_INFOB _dmx_password = 0x0505;
uint16_t SEG_INFOB _dmx_red = 0x00FF;
@spirilis
spirilis / gist:69ba53bf631c03fdc5fc
Last active August 29, 2015 14:06
First legit datalog from TI MSP430 Wolverine + AS3935 Franklin Lightning Sensor!
> help
Wolverine Franklin Lightning Logger
CLI syntax:
help - Print this help
count - Get a count of lightning events currently logged
limit - Get the max # of events storable in the FRAM buffer
retrieve <#> - Retrieve the #'th entry (starting at 0), or "all" pulls all events.
purge - Purge all lightning events from FRAM buffer
disable - Place AS3935 in low-power off mode
enable - Wake AS3935 into listening mode
@spirilis
spirilis / Wolv_Franklin_Logger.ino
Last active August 29, 2015 14:06
TI MSP430 Wolverine + AS3935 Franklin Lightning Sensor - Energia logger sketch
/* Wolverine Lightning Sensor Logger
*
* A sensor logging application for the TI MSP430 Wolverine which utilizes
* the Austria Microsystems AS3935 Franklin Lightning Sensor to sense lightning
* strikes and log them, timestamped, into the Wolverine's FRAM.
*/
#include <SPI.h>
#include <Franklin.h>
#include <RTC_B.h>
#include <string.h>
@spirilis
spirilis / main.c
Created September 4, 2014 14:23
Remote control illustrating Graycode incremental encoder interpretation
/* nRFDMX Remote Control implementation to send 3-letter RGB values based
* on a user-adjusted HSV colorspace system.
* Value adjusted by sliding potentiometer
* Hue adjusted by rotating a Rotary Encoder
* Saturation flipped between 1.0 and 0.1 by the rotary encoder pushbutton
*/
#include <msp430.h>
#include <stdint.h>
#include <sys/cdefs.h>