| 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 | |
| 25 | config_pins(); |
| 26 | pincnt(); |
| 27 | |
| 28 | start(); |
| 29 | byte(0x40); |
| 30 | stop(); |
| 31 | start(); |
| 32 | byte(0xc0 | 0x01); |
| 33 | |
| 34 | for(;;) { |
| 35 | arc4random_buf(ent, 32); |
| 36 | byte(ent[0]); |
| 37 | byte(ent[1]); |
| 38 | byte(ent[2]); |
| 39 | byte(ent[3]); |
| 40 | usleep(DEL); |
| 41 | } |
| 42 | stop(); |
| 43 | |
| 44 | start(); |
| 45 | byte(DISP_ON); |
| 46 | stop(); |
| 47 | |
| 48 | inth(0); |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | |