Skip to content

Input support (TXINH so far) #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
TXINH config changes
  • Loading branch information
ab0tj committed Nov 17, 2015
commit 64f9313f77e618f55cf725c7ab8ccaa09674bd2c
10 changes: 10 additions & 0 deletions audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ struct audio_s {

} octrl[NUM_OCTYPES];

#define ICTYPE_TXINH 0

#define NUM_ICTYPES 1

struct {
int enable; /* should we bother checking this input? */
int gpio; /* GPIO number */
int invert; /* 1 = active low */
} ictrl[NUM_ICTYPES];

/* Transmit timing. */

int dwait; /* First wait extra time for receiver squelch. */
Expand Down
46 changes: 46 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,52 @@ void config_init (char *fname, struct audio_s *p_audio_config,

} /* end of PTT */

/*
* INPUTS
*
* TXINH - TX holdoff input
*
* xxx GPIO [-]gpio-num (only type supported yet)
*/

else if (strcasecmp(t, "TXINH") == 0) {
int it;
char itname[8];

it = ICTYPE_TXINH;
strlcpy (itname, "TXINH", sizeof(itname));

t = split(NULL,0);
if (t == NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file line %d: Missing input type name for %s command.\n", line, itname);
continue;
}

if (strcasecmp(t, "GPIO") == 0) {

#if __WIN32__
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file line %d: %s with GPIO is only available on Linux.\n", line, itname);
#else
t = split(NULL,0);
if (t == NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file line %d: Missing GPIO number for %s.\n", line, itname);
continue;
}

if (*t == '-') {
p_audio_config->achan[channel].ictrl[it].gpio = atoi(t+1);
p_audio_config->achan[channel].ictrl[it].invert = 1;
}
else {
p_audio_config->achan[channel].ictrl[it].gpio = atoi(t);
p_audio_config->achan[channel].ictrl[it].invert = 0;
}
#endif
}
}

/*
* DWAIT - Extra delay for receiver squelch.
Expand Down