kopia lustrzana https://github.com/Hamlib/Hamlib
* started PTT support through serial port, this is a WIP
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@332 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.1
rodzic
50576d9502
commit
305ba73185
36
src/serial.c
36
src/serial.c
|
@ -6,7 +6,7 @@
|
|||
* Provides useful routines for read/write serial data for communicating
|
||||
* via serial interface.
|
||||
*
|
||||
* $Id: serial.c,v 1.4 2000-10-23 19:58:14 f4cfe Exp $
|
||||
* $Id: serial.c,v 1.5 2001-01-28 22:18:09 f4cfe Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -508,3 +508,37 @@ int fread_block(FILE *stream, unsigned char *rxbuffer, size_t count, int timeout
|
|||
return total_count; /* return bytes count read */
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: split ptt_set in ser_ptt_set and par_ptt_set
|
||||
* +ser_ptt_open/ser_ptt_close & par_ptt_open/par_ptt_close
|
||||
*/
|
||||
int ptt_set(int fd, ptt_type_t ptt_type, int pttx)
|
||||
{
|
||||
unsigned char y;
|
||||
|
||||
switch(ptt_type) {
|
||||
case RIG_PTT_SERIAL_RTS:
|
||||
y = TIOCM_RTS;
|
||||
return ioctl(fd, pttx ? TIOCMBIS : TIOCMBIC, &y);
|
||||
|
||||
case RIG_PTT_SERIAL_DTR:
|
||||
return -RIG_ENIMPL;
|
||||
y = TIOCM_DTR;
|
||||
return ioctl(fd, pttx ? TIOCMBIS : TIOCMBIC, &y);
|
||||
|
||||
#ifdef LINUX /* Have PPdev */
|
||||
case RIG_PTT_PARALLEL:
|
||||
{
|
||||
unsigned char reg;
|
||||
|
||||
reg = !!pttx;
|
||||
return ioctl(fd, PPWDATA, ®);
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n",ptt_type);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue