diff options
author | Leah Rowe <leah@libreboot.org> | 2023-06-04 17:16:26 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-06-04 17:16:26 +0100 |
commit | f7fccb5963e74d0be7c33bf8a6728611dd89bf73 (patch) | |
tree | c4403057574e66424e04a0de59a13c0306830440 /util/spkmodem_recv/spkmodem-recv.c | |
parent | b40a30b11bb59e792dd9cf0b7d0da9a6820ada13 (diff) |
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>
Diffstat (limited to 'util/spkmodem_recv/spkmodem-recv.c')
-rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index 01830bd6..d1fc6a34 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -30,6 +30,7 @@ char ascii = 0; void handle_audio(void); void fetch_sample(void); void read_frame(int ringpos); +int set_ascii_bit(void); void print_char(void); int @@ -69,7 +70,8 @@ handle_audio(void) fetch_sample(); return; } - print_char(); + if (!set_ascii_bit()) + print_char(); lp = llp = 0; for (int sample = 0; sample < SAMPLES_PER_FRAME; sample++) @@ -100,8 +102,8 @@ read_frame(int ringpos) err(ERR(), "Could not read from frame."); } -void -print_char(void) +int +set_ascii_bit(void) { #if DEBUG long stdin_pos = 0; @@ -112,8 +114,12 @@ print_char(void) #endif if (f1 < FREQ_DATA_THRESHOLD) ascii |= (1 << ascii_bit); - if (ascii_bit) - return; + return ascii_bit; +} + +void +print_char(void) +{ #if DEBUG printf("<%c, %x>", ascii, ascii); #else |