random panel output
authorIan Sutton <ian.sutton@ibm.com>
Thu, 13 Dec 2018 11:59:04 +0000 (05:59 -0600)
committerIan Sutton <ian.sutton@ibm.com>
Thu, 13 Dec 2018 11:59:04 +0000 (05:59 -0600)
seg.c
seg.h

diff --git a/seg.c b/seg.c
index 462b03f73667b9bc032501e5e0cdf87b112c6082..8af863e17ac946207dda701a06cbfa8b70b4079f 100644 (file)
--- a/seg.c
+++ b/seg.c
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
 
 #include <sys/types.h>
@@ -17,6 +18,8 @@
 
 int main(int argc, char *argv[]) {
 
+       uint8_t ent[4];
+
        signal(SIGINT, inth);
        
        config_pins();
@@ -28,17 +31,14 @@ int main(int argc, char *argv[]) {
        start();
        byte(0xc0 | 0x01);
 
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-       byte(0xdd);
-
+for(;;) {
+       arc4random_buf(ent, 32);
+       byte(ent[0]);
+       byte(ent[1]);
+       byte(ent[2]);
+       byte(ent[3]);
+       usleep(DEL);
+}
        stop();
 
        start();
diff --git a/seg.h b/seg.h
index 0d6c8a6361c755af2f576fa83b17913910bbfa8d..a831f5831c4fe8d0dce6f2c8e9ae739cedbd0a30 100644 (file)
--- a/seg.h
+++ b/seg.h
@@ -108,6 +108,10 @@ void set_pin(char *name, int state) {
 void config_pins() {
        struct gpio_pin_set *ser, *oe, *rclk, *srclk, *srclr, *dio, *clk;
 
+       /* ??? XXX wtf */
+       system("gpioctl gpio2 6 set out clk");
+       system("gpioctl gpio2 8 set out dio");
+
        ser   = calloc(1, sizeof(struct gpio_pin_set));
        oe    = calloc(1, sizeof(struct gpio_pin_set));
        rclk  = calloc(1, sizeof(struct gpio_pin_set));