annotate light8/parport.c @ 59:001646cd5349

all mousewheel events everywhere will now pass up the tree to be caught by all mousewheel events everywhere will now pass up the tree to be caught by higher widgets. if things get slow, this might be the problem
author drewp
date Tue, 09 Jul 2002 07:36:29 +0000
parents f974a462133f
children f0e27aa8f0f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 #include <stdio.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
2 #include <stdlib.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
3 #include <unistd.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
4 #include <sys/ioctl.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
5 #include <asm/io.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
6 #include <fcntl.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
7 #include <Python.h>
45b12307c695 Initial revision
drewp
parents:
diff changeset
8
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
9 void getparport() {
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
10 if( ioperm(888,3,1) ) {
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 printf("Couldn't get parallel port at 888-890\n");
45b12307c695 Initial revision
drewp
parents:
diff changeset
12
45b12307c695 Initial revision
drewp
parents:
diff changeset
13 // the following doesn't have any effect!
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 PyErr_SetString(PyExc_IOError,"Couldn't get parallel port at 888-890");
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
17
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 void outdata(unsigned char val) {
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 outb(val,888);
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
21
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 void outcontrol( unsigned char val ) {
45b12307c695 Initial revision
drewp
parents:
diff changeset
23 outb(val,890);
45b12307c695 Initial revision
drewp
parents:
diff changeset
24 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
25
45b12307c695 Initial revision
drewp
parents:
diff changeset
26 void outbyte( unsigned char val ) {
45b12307c695 Initial revision
drewp
parents:
diff changeset
27 // set data, raise clock, lower clock
45b12307c695 Initial revision
drewp
parents:
diff changeset
28 outdata(val);
45b12307c695 Initial revision
drewp
parents:
diff changeset
29 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
30 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
31 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
32 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
33 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
34 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
35 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
36 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
37 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
38 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
39 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
40 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
41 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
42 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
43 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
44 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
45 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
46 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
47 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
48 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
49 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
50 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
51 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
52 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
53 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
54 outcontrol(2);
45b12307c695 Initial revision
drewp
parents:
diff changeset
55 outcontrol(3);
45b12307c695 Initial revision
drewp
parents:
diff changeset
56 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
57 void outstart() {
45b12307c695 Initial revision
drewp
parents:
diff changeset
58 // send start code: pin 14 high, 5ms to let a dmx cycle finish,
45b12307c695 Initial revision
drewp
parents:
diff changeset
59 // then pin14 low (pin1 stays low)
45b12307c695 Initial revision
drewp
parents:
diff changeset
60 outcontrol(1);
45b12307c695 Initial revision
drewp
parents:
diff changeset
61 usleep(5000);
45b12307c695 Initial revision
drewp
parents:
diff changeset
62 outcontrol(3);
45b12307c695 Initial revision
drewp
parents:
diff changeset
63 }