mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-25 07:46:17 +02:00
util/spkmodem_recv: Move logic out of main
Main should only be a skeletal structure. Actual logic should always be handled externally. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -27,18 +27,26 @@ int amplitude = 0;
|
||||
int lp = 0;
|
||||
|
||||
void read_sample(void);
|
||||
void print_chars(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ascii_bit = 7;
|
||||
char ascii = 0;
|
||||
int i;
|
||||
int llp = 0;
|
||||
|
||||
(void)argc; (void)argv;
|
||||
|
||||
while (!feof(stdin)) {
|
||||
while (!feof(stdin))
|
||||
print_chars();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
print_chars(void)
|
||||
{
|
||||
static int ascii_bit = 7;
|
||||
static char ascii = 0;
|
||||
static int llp = 0;
|
||||
|
||||
if (lp > 3 * SAMPLES_PER_FRAME) {
|
||||
ascii_bit = 7;
|
||||
ascii = 0;
|
||||
@@ -51,7 +59,7 @@ main(int argc, char *argv[])
|
||||
if (f2 <= FREQ_SEP_MIN || f2 >= FREQ_SEP_MAX
|
||||
|| f1 <= FREQ_DATA_MIN || f1 >= FREQ_DATA_MAX) {
|
||||
read_sample();
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
#if DEBUG
|
||||
printf ("%d %d %d @%d\n", f1, f2, FREQ_DATA_THRESHOLD,
|
||||
@@ -71,10 +79,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
lp = 0;
|
||||
llp = 0;
|
||||
for (i = 0; i < SAMPLES_PER_FRAME; i++)
|
||||
for (int i = 0; i < SAMPLES_PER_FRAME; i++)
|
||||
read_sample();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user