Commit | Line | Data |
---|---|---|
9883c3e4 IS |
1 | #include <stdlib.h> |
2 | #include <fcntl.h> | |
3 | #include <signal.h> | |
4 | #include <unistd.h> | |
5 | #include <string.h> | |
6 | #include <stdio.h> | |
9f65bf39 | 7 | #include <stdlib.h> |
9883c3e4 IS |
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 | ||
9f65bf39 IS |
21 | uint8_t ent[4]; |
22 | ||
9883c3e4 | 23 | signal(SIGINT, inth); |
3bacb654 | 24 | signal(SIGALRM, SIG_DFL); |
9883c3e4 IS |
25 | |
26 | config_pins(); | |
27 | pincnt(); | |
28 | ||
2b25fa21 IS |
29 | // start(); |
30 | // byte(0x8f); | |
31 | // stop(); | |
3bacb654 | 32 | |
9883c3e4 IS |
33 | start(); |
34 | byte(0x40); | |
35 | stop(); | |
36 | start(); | |
2b25fa21 IS |
37 | byte(0xc0 | 0x03); |
38 | byte(0xff); | |
39 | byte(0xff); | |
40 | byte(0xff); | |
41 | byte(0xff); | |
42 | byte(0xff); | |
43 | byte(0xff); | |
3bacb654 | 44 | /*for(;;) { |
9f65bf39 IS |
45 | arc4random_buf(ent, 32); |
46 | byte(ent[0]); | |
47 | byte(ent[1]); | |
48 | byte(ent[2]); | |
49 | byte(ent[3]); | |
50 | usleep(DEL); | |
3bacb654 IS |
51 | }*/ |
52 | ||
2b25fa21 | 53 | /*for(;;) { |
3bacb654 | 54 | UP("clk"); |
a315fde8 | 55 | usleep(1); |
3bacb654 | 56 | DOWN("clk"); |
a315fde8 | 57 | usleep(1); |
2b25fa21 | 58 | }*/ |
3bacb654 IS |
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(); | |
9883c3e4 IS |
87 | |
88 | start(); | |
89 | byte(DISP_ON); | |
3bacb654 IS |
90 | stop();*/ |
91 | ||
9883c3e4 IS |
92 | |
93 | inth(0); | |
94 | return 0; | |
95 | } | |
96 | ||
97 |