neerly working version of rf433rcv
[svn42.git] / rf433rcv / pc / compress.c
diff --git a/rf433rcv/pc/compress.c b/rf433rcv/pc/compress.c
new file mode 100644 (file)
index 0000000..1e211d5
--- /dev/null
@@ -0,0 +1,24 @@
+#include <unistd.h>
+
+
+void main()
+{
+  unsigned char c,out=0;
+  int count =0;
+  while (read(0,&c,1))
+  {
+    out<<=1;
+    if (c=='1')
+      out |=1;
+    count++;  
+    if (count ==8)
+    {
+      write(1,&out,1);
+      count=0;
+      out=0;
+    }
+  }
+  out<<=8-count;
+  out |= 0xff>>count;
+  write(1,&out,1);
+}