Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int par_ptt_set ( hamlib_port_t p,
ptt_t  pttx 
)

Set or unset Push to talk bit on Parallel Port.

Parameters:
p 
pttx RIG_PTT_ON --> Set PTT
Returns:
RIG_OK or < 0 error

Definition at line 383 of file parallel.c.

References par_lock(), par_read_control(), par_unlock(), par_write_control(), hamlib_port_t::ptt, rig_debug(), RIG_DEBUG_ERR, RIG_EINVAL, RIG_OK, RIG_PTT_ON, RIG_PTT_PARALLEL, and hamlib_port_t::type.

Referenced by rig_close(), rig_open(), and rig_set_ptt().

{
      switch(p->type.ptt) {
      case RIG_PTT_PARALLEL:
            {
            unsigned char ctl;
            int status;

            par_lock (p);
            status = par_read_control(p, &ctl);
            if (status != RIG_OK)
                  return status;

            /* Enable CW & PTT - /STROBE bit (pin 1) */
            ctl &= ~PARPORT_CONTROL_STROBE;

            /* TODO: kill parm.parallel.pin? */

            /* PTT keying - /INIT bit (pin 16) (inverted) */
            if (pttx == RIG_PTT_ON)
                  ctl |= PARPORT_CONTROL_INIT;
            else
                  ctl &= ~PARPORT_CONTROL_INIT;

            status = par_write_control(p, ctl);
            par_unlock (p);
            return status;
            }
      default:
            rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n", 
                                    p->type.ptt);
            return -RIG_EINVAL;
      }
      return RIG_OK;
}


Generated by  Doxygen 1.6.0   Back to index