X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=rf433rcv%2Fpc%2Fcompress.c;fp=rf433rcv%2Fpc%2Fcompress.c;h=1e211d5943022b94dc86127c20330c7be3d569ea;hp=0000000000000000000000000000000000000000;hb=f505a1c37ea1c76897991f9882de765e34f0cc98;hpb=02293cb00639b97ca422619ee15f5981a5b3ffd0 diff --git a/rf433rcv/pc/compress.c b/rf433rcv/pc/compress.c new file mode 100644 index 0000000..1e211d5 --- /dev/null +++ b/rf433rcv/pc/compress.c @@ -0,0 +1,24 @@ +#include + + +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); +}