/expose-teensy

a driver to expose functions from the teensy board as character devices

Primary LanguageCOtherNOASSERTION

CS 572 Class Project, Fall 2010 at Portland State University
============================================================

The objective is to develop a general purpose driver for the teensy
micro-controller that exposes a series of abstract character devices
in userland. These devices will control various aspects of the teensy
for a variety of purposes. The idea is that a simple set of ioctls,
along with reads and writes can provide general purpose functionality
without fiddly access to the teensy directly.

Important Warning
=================

This project involves connecting a general purpose microcontroller
directly to your usb controllers and then doing arbitrary things with
them. If you don't know what you're doing, you could easily fry your
usb controllers on you spiffy new laptop. You could also let the magic
smoke out of your fun new teensy. Proceed at your own risk. You have
been warned!


Building
========

There are included Makefiles for building everything in this
project. But, note that this is written against the 2.6.24 linux
kernel and may not build cleanly against just any ol' kernel. 

 --- Kernel module:
 
    Building the kernel module requires the appropriate kernel headers
    be installed. If you are running a 2.6.24 kernel, then the
    makefile should just find the headers (assuming they are
    installed). If you are building while running a different kernel,
    it makefile looks in your home directory for
    src/linux-2.6.24. It's up to you to fix that however is
    appropriate. 

 --- Teensy code:
 
    The actual code to run on the teensy requires the following
    packages (using Debian names because that what we build on):

        gcc-avr
        avr-libc

    That should get you a reasonable build-environment to compile for
    the teensy.

Using
=====

To use the code, you have to first insert the kernel module in the
usual way:

    insmod teensy_mono.ko

And then plug in the device. The module will see the teensy and
configure itself to expose some adc converters and two motor
controllers. These are character devices that interact as follows:

/dev/adc[01]: a read() on these devices will return one 8 bit reading
from the appropriate adc device on the teensy. 

/dev/mc[01]: using ioctl()'s, you can control a dc motor connected to
the teensy. See teensy_mc.h for details of available ioctls and see
the diagrams for how to hook up a couple of motors to the pwms.