fixaroonie
[bort-panel.git] / seg.c
1 #include <stdlib.h>
2 #include <fcntl.h>
3 #include <signal.h>
4 #include <unistd.h>
5 #include <string.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <time.h>
9
10 #include <sys/types.h>
11 #include <sys/gpio.h>
12 #include <sys/ioctl.h>
13
14 #include "seg.h"
15
16 #define UP(N) set_pin(N, 1)
17 #define DOWN(N) set_pin(N, 0)
18
19 int main(int argc, char *argv[]) {
20
21 uint8_t ent[4];
22
23 signal(SIGINT, inth);
24 signal(SIGALRM, SIG_DFL);
25
26 config_pins();
27 pincnt();
28
29 start();
30 byte(0x8f);
31 stop();
32
33 start();
34 byte(0x40);
35 stop();
36 start();
37 byte(0xc0 | 0x00);
38 byte(0x00);
39 byte(0x00);
40 byte(0x00);
41 byte(0x00);
42 byte(0x00);
43 byte(0x00);
44 /*for(;;) {
45 arc4random_buf(ent, 32);
46 byte(ent[0]);
47 byte(ent[1]);
48 byte(ent[2]);
49 byte(ent[3]);
50 usleep(DEL);
51 }*/
52
53 for(;;) {
54 UP("clk");
55 usleep(1);
56 DOWN("clk");
57 usleep(1);
58 }
59
60 for(;;) {
61 byte(dig(0x0c));
62 byte(dig(0x0a));
63 byte(dig(0x0f));
64 byte(dig(0x0e));
65 byte(0x00);
66 byte(0x00);
67 usleep(1000 * 350);
68 byte(dig(0x0b));
69 byte(dig(0x0a));
70 byte(dig(0x0b));
71 byte(dig(0x0e));
72 byte(0x00);
73 byte(0x00);
74 usleep(1000*350);
75 }
76 /* uint8_t inc = 0;
77 uint8_t c = 0;
78 for(;;) {
79 if (c == 4) { byte(0x00); byte(0x00); c = 0; continue;}
80 byte(dig(inc));
81 if (inc == 0xf) { inc = 0; usleep(1000 * 2000); c++; continue; }
82 inc++;
83 usleep(1000 * 700);
84 c++;
85 } */
86 /* stop();
87
88 start();
89 byte(DISP_ON);
90 stop();*/
91
92
93 inth(0);
94 return 0;
95 }
96
97