mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-21 19:26:22 +02:00
util/spkmodem-recv: simplify sample_cnt/char reset
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#define THRESHOLD 500
|
#define THRESHOLD 500
|
||||||
|
|
||||||
#define ERR() (errno = errno ? errno : ECANCELED)
|
#define ERR() (errno = errno ? errno : ECANCELED)
|
||||||
|
#define reset_char() ascii = 0, ascii_bit = 7
|
||||||
|
|
||||||
signed short frame[2 * SAMPLES_PER_FRAME], pulse[2 * SAMPLES_PER_FRAME];
|
signed short frame[2 * SAMPLES_PER_FRAME], pulse[2 * SAMPLES_PER_FRAME];
|
||||||
int debug, freq_data, freq_separator, sample_count, ascii_bit = 7;
|
int debug, freq_data, freq_separator, sample_count, ascii_bit = 7;
|
||||||
@@ -56,10 +57,8 @@ main(int argc, char *argv[])
|
|||||||
void
|
void
|
||||||
handle_audio(void)
|
handle_audio(void)
|
||||||
{
|
{
|
||||||
if (sample_count > (3 * SAMPLES_PER_FRAME)) {
|
if (sample_count > (3 * SAMPLES_PER_FRAME))
|
||||||
ascii_bit = 7;
|
sample_count = reset_char();
|
||||||
ascii = sample_count = 0;
|
|
||||||
}
|
|
||||||
if ((freq_separator <= FREQ_SEP_MIN) || (freq_separator >= FREQ_SEP_MAX)
|
if ((freq_separator <= FREQ_SEP_MIN) || (freq_separator >= FREQ_SEP_MAX)
|
||||||
|| (freq_data <= FREQ_DATA_MIN) || (freq_data >= FREQ_DATA_MAX)) {
|
|| (freq_data <= FREQ_DATA_MIN) || (freq_data >= FREQ_DATA_MAX)) {
|
||||||
fetch_sample();
|
fetch_sample();
|
||||||
@@ -116,8 +115,7 @@ print_char(void)
|
|||||||
printf("<%c, %x>", ascii, ascii);
|
printf("<%c, %x>", ascii, ascii);
|
||||||
else
|
else
|
||||||
printf("%c", ascii);
|
printf("%c", ascii);
|
||||||
ascii_bit = 7;
|
reset_char();
|
||||||
ascii = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user