Skip to content

Instantly share code, notes, and snippets.

View spirilis's full-sized avatar

Eric spirilis

  • Maryland, USA
View GitHub Profile
@spirilis
spirilis / oledi2c_v2.c
Created January 29, 2018 02:34
MSP432 LaunchPad demo'ing TI logo on I2C OLED display
/*
* Copyright (c) 2015-2017, Texas Instruments Incorporated
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer.
@spirilis
spirilis / main.c
Created November 17, 2017 15:55
MSP430FR2433 basic dual UART loopback echo with UART_DETECT line lighting up P1.1 (green LED) and P1.0 during activity
/* --COPYRIGHT--,BSD
* Copyright (c) 2017, Texas Instruments Incorporated
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer.
@spirilis
spirilis / fr2433_uart1.c
Created November 17, 2017 03:11
Basic example of MSP430FR2433 UART usage with driverlib
void main() {
...
// eUSCI_A0 support
P1SEL1 &= ~(BIT4 | BIT5);
P1SEL0 |= BIT4|BIT5;
PMM_unlockLPM5();
...
// MCLK, SMCLK are both at 16MHz running off DCO with FLL bound to XT1 crystal
...
// Initialize eUSCI_A0
@spirilis
spirilis / Greetings.h
Created September 22, 2015 18:18
RadioBot TM4C129 IRC bot
/* Greeting-related handlers */
#ifndef GREETINGS_H
#define GREETINGS_H
void HandleHi(void *, const char *, const char *, const char *);
void KillBot(void *, const char *, const char *, const char *);
void MeetAndGreet(void *, const char *, const char *, const char *);
void RollOver(void *, const char *, const char *, const char *);
@spirilis
spirilis / RXGPIO.h
Created September 21, 2015 08:41
RX GPIO Template class - fabooh-esque
/* GPIO type for Renesas RX (useful for hardcoding port+bit information
* for use by other templated C++ class libraries)
*
* Applicable for RX2xx and RX63x chips only thus far.
*/
#ifndef RXGPIO_H
#define RXGPIO_H
#include <AbstractWiring.h>
@spirilis
spirilis / rx_peripheral_gen.awk
Created September 11, 2015 13:56
RX iodefine constant ldscript+header generator
/^struct .* \{/ {
allstructs[$2] = 1;
}
/^#define[ \t].*volatile struct.*0x/ {
struct_name = $5;
sfrname = $2;
sfr_addr = substr($6,3, length($6)-3);
if (allstructs[struct_name] == 1) {
sfr[sfrname] = struct_name;
@spirilis
spirilis / Compiler_output
Created September 8, 2015 23:00
C++ templated RSPI driver, take 2
18:58:42 **** Incremental Build of configuration HardwareDebug for project test ****
make -j4 all
'Scanning and building file: ../src/test.cpp'
'Invoking: Scanner and Compiler'
rx-elf-gcc -MM -MP -MF "src/test.d" -MT"src/test.o" -MT"src/test.d" -x c++ -nostdinc -ffunction-sections -fno-function-cse -fdata-sections -fsection-anchors -free -flto-compression-level=0 -fno-cse-follow-jumps -fno-jump-tables -fno-guess-branch-probability -fno-move-loop-invariants -I"C:\PROGRA~2\KPIT\GNURXV~1.03-\rx-elf\rx-elf/lib/gcc/rx-elf/4.8-GNURX_v14.03/include" -I"C:\PROGRA~2\KPIT\GNURXV~1.03-\rx-elf\rx-elf/rx-elf/include" -I"C:\Renesas\workspace\test\src" -D__RX_LITTLE_ENDIAN__=1 -DCPPAPP -Os -g2 -g -flto -mlittle-endian-data -mcpu=rx200 -nofpu -fno-exceptions -fno-rtti "../src/test.cpp"
In file included from ../src/test.cpp:20:0:
C:\Renesas\workspace\test\src/RSPI_RX210.h: In instantiation of 'uint8_t RSPI_RX210<rspidrv>::transfer(uint8_t) [with volatile st_rspi& rspidrv = (* & SFRBASE_RSPI0); uint8_t = unsigned char]':
..
@spirilis
spirilis / Compiler_output
Last active September 8, 2015 21:13
take 1 on C++ templated RSPI driver
17:10:20 **** Incremental Build of configuration HardwareDebug for project test ****
make -j4 all
'Scanning and building file: ../src/test.cpp'
'Invoking: Scanner and Compiler'
rx-elf-gcc -MM -MP -MF "src/test.d" -MT"src/test.o" -MT"src/test.d" -x c++ -nostdinc -ffunction-sections -fno-function-cse -fdata-sections -fsection-anchors -free -flto-compression-level=0 -fno-cse-follow-jumps -fno-jump-tables -fno-guess-branch-probability -fno-move-loop-invariants -I"C:\PROGRA~2\KPIT\GNURXV~1.03-\rx-elf\rx-elf/lib/gcc/rx-elf/4.8-GNURX_v14.03/include" -I"C:\PROGRA~2\KPIT\GNURXV~1.03-\rx-elf\rx-elf/rx-elf/include" -I"C:\Renesas\workspace\test\src" -D__RX_LITTLE_ENDIAN__=1 -DCPPAPP -Os -g2 -g -flto -mlittle-endian-data -mcpu=rx200 -nofpu -fno-exceptions -fno-rtti "../src/test.cpp"
../src/test.cpp:22:29: error: cannot declare variable 'SPI' to be of abstract type 'RSPI_RX210<0u>'
RSPI_RX210<RSPI_INSTANCE_0> SPI;
^
In file included from ../src/test.cpp:20:0:
C:\Renesas\workspace\test\src/R
@spirilis
spirilis / dataflash_rx62n.c
Created September 8, 2015 00:44
RX62N DataFlash R/W example library
/*
* dataflash_rx62n.c
*
* Created on: Nov 30, 2012
* Author: spirilis
*/
#include <stdint.h>
#include "iodefine.h"
#include "dataflash_rx62n.h"
@spirilis
spirilis / rx2108.ld
Created September 8, 2015 00:41
RX210 ldscript example - providing Option Words
/* Default value for Endian and Option Bytes is all binary-1's
* which provide a reasonably safe (if slow) default.
* Default Endian = Little-Endian
*/
PROVIDE (__mdes = 0xFFFFFFFF);
PROVIDE (__ofs0 = 0xFFFFFFFF);
PROVIDE (__ofs1 = 0xFFFFFFFF);
.endian (0xFFFFFF80) :
{