File generation in C

A project log for DYPLED

a thin LED display in SIP module format, much better than TIL311s to visualise your computer buses

yann-guidon-ygdesYann Guidon / YGDES 08/20/2016 at 20:590 Comments

It took me 3h only (and I was not rushing) to translate the JS code into C and get a decent binary file. I've just uploaded the source and the generated file in the main page.

C has its own gotchas but the many debug features I used in JS have been very useful in C so the port was a breeze. Compilation is easy:

gcc -Wall -o shuffle shuffle.c
Execution is pretty fast too:
$ /usr/bin/time ./shuffle > DYPLED.bin
0.85user 0.01system 0:00.88elapsed 99%CPU
(0avgtext+0avgdata 1392maxresident)k
0inputs+4096outputs (0major+111minor)pagefaults 0swaps
And to check the output, add any argument on the command line.

The source code is very flexible, allowing me to adjust and adapt the data, for any change during the first tests and for the next generation of displays derived from it.