Files @ 79bc84310e80
Branch filter:

Location: light9/light8/serport.i

dmcc
changes from tonight's rehearsal:
changes from tonight's rehearsal:
- CueFader is closer to actually running the show, computes DMX levels
to send.
- KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it.
- Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved
or loaded. to save a temporary sub, make a copy of it with a proper name
since the computed name will be ugly.
Also, get_normalized_copy() and crossfade() methods added.
linear_fade helper (shouldn't be in Submaster, probably) added too.
- dmxchanedit: longer labels
- cuelist1 now has some bogus data in it and some crap removed
- dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables.
- patchdata: now up to date with this year's show
- danshow subs song{01..19}: removed. maybe we'll re-add them in an
archive directory.
%module serport

%{
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <unistd.h>
%}


%typemap(python,in) __u8 {
  if( !PyInt_Check($input)) {
    PyErr_SetString(PyExc_TypeError,"not an integer");
    return NULL;
  }
  $1 = ($type) PyInt_AsLong($input);
}

%typemap(python,out) __s32 {
  $result = Py_BuildValue("i", ($type) $1);
}

%inline %{

  __s32 i2c_smbus_write_byte(int file, __u8 value);
  __s32 i2c_smbus_read_byte(int file);

  PyObject *read_all_adc(int file) {
    PyObject *t=PyTuple_New(4);
    
    #define CHAN_TO_TUPLE_POS(chan,idx) i2c_smbus_write_byte(file, chan);\
    PyTuple_SetItem(t,idx,PyInt_FromLong(i2c_smbus_read_byte(file)));

    /*
      these are shuffled here to match the way the pots read in. in
      the returned tuple, 0=left pot..3=right pot.
    */
    CHAN_TO_TUPLE_POS(1,0)
    CHAN_TO_TUPLE_POS(2,1)
    CHAN_TO_TUPLE_POS(3,2)
    CHAN_TO_TUPLE_POS(0,3)
      
    return t;

  }

%}