comparison light8/serport.i @ 75:0b86bf6808f8

new serial port module to read the PCF8591 chip with the sliders on it
author drewp
date Fri, 12 Jul 2002 09:55:52 +0000
parents 45b12307c695
children 4455a7e86643
comparison
equal deleted inserted replaced
74:2dfae9ed1cda 75:0b86bf6808f8
32 PyObject *t=PyTuple_New(4); 32 PyObject *t=PyTuple_New(4);
33 33
34 #define CHAN_TO_TUPLE_POS(chan,idx) i2c_smbus_write_byte(file, chan);\ 34 #define CHAN_TO_TUPLE_POS(chan,idx) i2c_smbus_write_byte(file, chan);\
35 PyTuple_SetItem(t,idx,PyInt_FromLong(i2c_smbus_read_byte(file))); 35 PyTuple_SetItem(t,idx,PyInt_FromLong(i2c_smbus_read_byte(file)));
36 36
37 /*
38 these are shuffled here to match the way the pots read in. in
39 the returned tuple, 0=left pot..3=right pot.
40 */
41 CHAN_TO_TUPLE_POS(1,0) 37 CHAN_TO_TUPLE_POS(1,0)
42 CHAN_TO_TUPLE_POS(2,1) 38 CHAN_TO_TUPLE_POS(2,1)
43 CHAN_TO_TUPLE_POS(3,2) 39 CHAN_TO_TUPLE_POS(3,2)
44 CHAN_TO_TUPLE_POS(0,3) 40 CHAN_TO_TUPLE_POS(0,3)
45 41