Commit c1753bdf9d7694bca94dff81a71b3d9ba69517f9

Authored by Arnaud Blanchard
1 parent eaa5664b

Add code comments

Showing 1 changed file with 6 additions and 4 deletions
... ... @@ -12,7 +12,7 @@
int period;
float refresh_rate; //µs;
float refresh_rate; //ms;
blc_channel output;
double step;
char const *display;
... ... @@ -45,7 +45,7 @@ static void start_float_loop(float frequency, float min, float max){
float time_gain, offset, gain;
time_gain=frequency*2*M_PI/(float)output.total_length*refresh_rate/1000;
if (output.sem_ack_data) refresh_rate=0;
if (output.sem_ack_data) refresh_rate=0; //We follow the rate of the reader and not our own rate
gain=(max-min)/2.f; //amplitude sinus = 2
offset=min+gain; //min sinus*gain = -gain
... ... @@ -54,6 +54,7 @@ static void start_float_loop(float frequency, float min, float max){
FOR(i, output.total_length){
output.floats[i]=sin((blc_loop_iteration*output.total_length+i)*time_gain)*gain+offset;
}
if(display){
blc_fprint_float_graph(stderr, output.floats, output.total_length, "oscillation", columns_nb, rows_nb, 1, 0, "Time", "Intensity");
blc_eprint_cursor_up(rows_nb);
... ... @@ -100,12 +101,13 @@ int main(int argc, char **argv){
default:EXIT_ON_CHANNEL_ERROR(&output, "Type not managed");
}
gain *= amp;*/
/*
blc_command_add("i", info_cb, NULL, "display value", NULL);
blc_command_add("p", period_cb, "period(ms)", "signal period", NULL);
blc_command_add("r", refresh_cb, "step(ms)", "time step", NULL);
*/
blc_loop_try_add_waiting_semaphore(output.sem_ack_data);
blc_loop_try_add_posting_semaphore(output.sem_new_data);
... ...