mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-19 00:03:45 +02:00
util/spkmodem-recv: split up handle_audio()
the signal check should be its own function, for clearer understanding Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -56,6 +56,7 @@ struct decoder_state {
|
|||||||
static const char *argv0;
|
static const char *argv0;
|
||||||
|
|
||||||
static void handle_audio(struct decoder_state *st);
|
static void handle_audio(struct decoder_state *st);
|
||||||
|
static int valid_signal(struct decoder_state *st);
|
||||||
static void decode_pulse(struct decoder_state *st);
|
static void decode_pulse(struct decoder_state *st);
|
||||||
static int set_ascii_bit(struct decoder_state *st);
|
static int set_ascii_bit(struct decoder_state *st);
|
||||||
static void print_char(struct decoder_state *st);
|
static void print_char(struct decoder_state *st);
|
||||||
@@ -123,10 +124,7 @@ handle_audio(struct decoder_state *st)
|
|||||||
if (st->sample_count > (3 * SAMPLES_PER_FRAME))
|
if (st->sample_count > (3 * SAMPLES_PER_FRAME))
|
||||||
reset_char(st);
|
reset_char(st);
|
||||||
|
|
||||||
if ((st->freq_separator > FREQ_SEP_MIN) &&
|
if (valid_signal(st)) {
|
||||||
(st->freq_separator < FREQ_SEP_MAX) &&
|
|
||||||
(st->freq_data > FREQ_DATA_MIN) &&
|
|
||||||
(st->freq_data < FREQ_DATA_MAX)) {
|
|
||||||
|
|
||||||
if (set_ascii_bit(st) < 0)
|
if (set_ascii_bit(st) < 0)
|
||||||
print_char(st);
|
print_char(st);
|
||||||
@@ -141,6 +139,15 @@ handle_audio(struct decoder_state *st)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
valid_signal(struct decoder_state *st)
|
||||||
|
{
|
||||||
|
return (st->freq_separator > FREQ_SEP_MIN &&
|
||||||
|
st->freq_separator < FREQ_SEP_MAX &&
|
||||||
|
st->freq_data > FREQ_DATA_MIN &&
|
||||||
|
st->freq_data < FREQ_DATA_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decode_pulse(struct decoder_state *st)
|
decode_pulse(struct decoder_state *st)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user