util/spkmodem-recv: split print_char() up
the logic for *setting* a character, and the logic for outputting it, ought to be separate. do that. Signed-off-by: Leah Rowe <leah@libreboot.org>fsdg20230625
parent
b40a30b11b
commit
f7fccb5963
|
@ -30,6 +30,7 @@ char ascii = 0;
|
||||||
void handle_audio(void);
|
void handle_audio(void);
|
||||||
void fetch_sample(void);
|
void fetch_sample(void);
|
||||||
void read_frame(int ringpos);
|
void read_frame(int ringpos);
|
||||||
|
int set_ascii_bit(void);
|
||||||
void print_char(void);
|
void print_char(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -69,6 +70,7 @@ handle_audio(void)
|
||||||
fetch_sample();
|
fetch_sample();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!set_ascii_bit())
|
||||||
print_char();
|
print_char();
|
||||||
|
|
||||||
lp = llp = 0;
|
lp = llp = 0;
|
||||||
|
@ -100,8 +102,8 @@ read_frame(int ringpos)
|
||||||
err(ERR(), "Could not read from frame.");
|
err(ERR(), "Could not read from frame.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
print_char(void)
|
set_ascii_bit(void)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
long stdin_pos = 0;
|
long stdin_pos = 0;
|
||||||
|
@ -112,8 +114,12 @@ print_char(void)
|
||||||
#endif
|
#endif
|
||||||
if (f1 < FREQ_DATA_THRESHOLD)
|
if (f1 < FREQ_DATA_THRESHOLD)
|
||||||
ascii |= (1 << ascii_bit);
|
ascii |= (1 << ascii_bit);
|
||||||
if (ascii_bit)
|
return ascii_bit;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_char(void)
|
||||||
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
printf("<%c, %x>", ascii, ascii);
|
printf("<%c, %x>", ascii, ascii);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue