Skip to content

Instantly share code, notes, and snippets.

@four0four
four0four / c8051_SDCC.h
Created August 24, 2014 21:51
Modified c8051_SDCC.h
//-----------------------------------------------------------------------------
// This file is for use in Embedded Control when using the SDCC compiler
//
// Directions:
//
// This file should be saved to the following directory on your laptop:
// C:\Program Files\SDCC\include\mcs51
// Save as c8051_SDCC.h
//
// In your program, you need to include this header file as #include <c8051_SDCC.h>
@four0four
four0four / Makefile
Last active November 16, 2015 06:26
Example C8051/ec2-drv project
PROGRAM=hw1
SOURCES=$(PROGRAM).c
# you should probably redefine this with an absolute path, if possible
INCLUDE=../headers
CC=sdcc
PORT="USB"
TARGET="SL51"
GDB=newcdb
all: $(PROGRAM).ihx flash run
@four0four
four0four / PKGBUILD
Last active November 16, 2015 06:29
ec2drv PKGBUILD
# Maintainer: Galen Schretlen <[email protected]>
pkgname=ec2drv-git
pkgdesc="ec2drv provides Linux support for the Silicon Laboritories EC2 serial debug adaptor."
_sourcename="ec2"
pkgrel=1
pkgver=86ffac6
arch=('i686' 'x86_64')
url="https://github.com/four0four/ec2"
license=('GPL')
depends=('python2' 'boost-libs' 'readline' 'libusb')
@four0four
four0four / mega324
Last active December 9, 2015 23:08
couple AVR UART examples
/*
* mega324_UART.c
*
* Created: 12/28/2011 10:39:01 PM
* Author: Galen
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/power.h>
@four0four
four0four / test.networkClasses.py
Created July 24, 2012 16:23
Simple test "framework" for the networkClasses module/hackery
#!/usr/bin/python2
import networkClasses
test = networkClasses.Subnet("192.168.0.1","255.255.0.0")
#test = networkClasses.Subnet("192.168.0.1/16")
print ".toIPaddress(): " + str(test.toIPaddress())
print ".toBroadcast(): " + str(test.toBroadcast())
print ".toNetmask(): " + str(test.toNetmask())
print ".toSubnet(): " + str(test.toSubnet())
@four0four
four0four / networkClasses.py
Created July 20, 2012 20:32
takes either a subnet (w.x.y.z/16) or an ip/netmask combination (w.x.y.z, 255.255.0.0) and provides all the rest. mostly useful for scripts, not people.
#http://wiki.python.org/moin/BitManipulation
def countBits(int_type):
count = 0
while(int_type):
int_type &= int_type - 1
count += 1
return(count)
class Subnet: