Update main.c fix add process

beta-adc
Alan Johnston 2 years ago committed by GitHub
parent dfcc69dddf
commit 53a4ad03e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2273,13 +2273,16 @@ void read_adc_process(int sig_num)
{ {
// fprintf(stderr,"read_adc_process starting\n"); // fprintf(stderr,"read_adc_process starting\n");
// if(sig_num == SIGALRM) if(sig_num == SIGALRM)
{ {
// read ADC // read ADC
// printf("read_adc_process\n"); // printf("read_adc_process\n");
if (wav_position > (BUFFER_SIZE - 1)) { if (wav_position > (BUFFER_SIZE - 1)) {
// set pwm level wav_position++;
// allow the pwm value to repeat for 8 cycles this is >>3 } else {
// reset to start
wav_position = 0;
}
adc_buffer[wav_position] = 0; adc_buffer[wav_position] = 0;
if(read(adc_file, data, 1) != 1) if(read(adc_file, data, 1) != 1)
{ {
@ -2294,11 +2297,6 @@ void read_adc_process(int sig_num)
fprintf(stderr, "Digital value of analog input: %d in %d us\n", data[0], micros() - time_start); // millis() - time_start); fprintf(stderr, "Digital value of analog input: %d in %d us\n", data[0], micros() - time_start); // millis() - time_start);
} }
wav_position++;
} else {
// reset to start
wav_position = 0;
}
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.