X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=square%2Fsrc%2FGen.c;fp=square%2Fsrc%2FGen.c;h=133e5aa6d779f706f30a3d5e1511343e1089caa9;hb=72e08f31e7589c2901158d3abdb7e116c6c6f83e;hp=0000000000000000000000000000000000000000;hpb=288a00688bd1ef5ffad268212df3c54c7c8c4e30;p=jump.git diff --git a/square/src/Gen.c b/square/src/Gen.c new file mode 100644 index 0000000..133e5aa --- /dev/null +++ b/square/src/Gen.c @@ -0,0 +1,28 @@ +#include +#include "Gen.h" + +void Gen_delay(void) +{ + for(volatile int a = 0; a < 50; a++) + for(volatile int b = 0; b < 2000000; b++) + ; +} + +void Gen_init(DOLProcess *p) { + ((Gen_State*)p->local)->index = 0; +} + +int Gen_fire(DOLProcess *p) { + float i; + + if (p->local->index < LENGTH) { +Gen_delay(); + p->local->index++; + i = p->local->index; + DOL_write(PORT_OUTPUT, &i, sizeof(float), p); + } else { + DOL_detach(p); + } + + return 0; +}