All pastes #828700 Raw Edit

Something

public c v1 · immutable
#828700 ·published 2007-12-22 17:59 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>int main(int argc, char *argv[]){  long F_CPU=(long) atoi(argv[argc-2]);  int RBAUD=(int) atoi(argv[argc-1]);    int pulse_res=(F_CPU/256/RBAUD)-1;   int c;  //printf("hello, F_CPU=%d, RBAUD=%d, pulse_res=%d\n",F_CPU,RBAUD,pulse_res);  FILE *fone;  fone = fopen("table.h","w+");  fprintf(fone,"const uint8_t sin_l[%d] PROGMEM={",pulse_res);  for(c=0;c<pulse_res;c++)  {   fprintf(fone,"%d,",(int) 255*(1-cos(M_PI*c/pulse_res))/2);  }  c=pulse_res;  fprintf(fone,"%d};",(int) 255*(1-cos(M_PI*c/pulse_res))/2);  fclose(fone);  //system("PAUSE");	  return 0;}