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 all commits
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
4 changes: 4 additions & 0 deletions atest.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ void ptt_set (int ot, int chan, int ptt_signal)
return;
}

int get_input (int it, int chan)
{
return -1;
}

static void usage (void) {

Expand Down
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 {
ptt_method_t method; /* none, serial port, GPIO, LPT. */
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
47 changes: 47 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,53 @@ 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;
}
p_audio_config->achan[channel].ictrl[it].method = PTT_METHOD_GPIO;
#endif
}
}

/*
* DWAIT - Extra delay for receiver squelch.
Expand Down
6 changes: 5 additions & 1 deletion hdlc_rec.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,13 @@ void dcd_change (int chan, int subchan, int state)

int hdlc_rec_data_detect_any (int chan)
{
int busy = 0;

assert (chan >= 0 && chan < MAX_CHANS);

return (composite_dcd[chan] != 0);
if (composite_dcd[chan] != 0) busy = 1;

if (get_input(ICTYPE_TXINH, chan) == 1) busy = 1;

} /* end hdlc_rec_data_detect_any */

Expand Down
Loading