MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / par_ptt_set

Function par_ptt_set

src/parallel.c:623–671  ·  view source on GitHub ↗

* \brief Set or unset Push to talk bit on Parallel Port * \param p * \param pttx RIG_PTT_ON --> Set PTT * \return RIG_OK or < 0 error */

Source from the content-addressed store, hash-verified

621 * \return RIG_OK or < 0 error
622 */
623int par_ptt_set(hamlib_port_t *p, ptt_t pttx)
624{
625 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
626
627 switch (p->type.ptt)
628 {
629 case RIG_PTT_PARALLEL:
630 {
631 unsigned char ctl;
632 int status;
633
634 par_lock(p);
635 status = par_read_control(p, &ctl);
636
637 if (status != RIG_OK)
638 {
639 return status;
640 }
641
642 /* Enable CW & PTT - /STROBE bit (pin 1) */
643 ctl &= ~PARPORT_CONTROL_STROBE;
644
645 /* TODO: kill parm.parallel.pin? */
646
647 /* PTT keying - /INIT bit (pin 16) (inverted) */
648 if (pttx == RIG_PTT_ON)
649 {
650 ctl |= PARPORT_CONTROL_INIT;
651 }
652 else
653 {
654 ctl &= ~PARPORT_CONTROL_INIT;
655 }
656
657 status = par_write_control(p, ctl);
658 par_unlock(p);
659 return status;
660 }
661
662 default:
663 rig_debug(RIG_DEBUG_ERR,
664 "%s: unsupported PTT type %d\n",
665 __func__,
666 p->type.ptt);
667 return -RIG_EINVAL;
668 }
669
670 return RIG_OK;
671}
672
673
674/**

Callers 3

rig_openFunction · 0.85
rig_closeFunction · 0.85
rig_set_pttFunction · 0.85

Calls 5

rig_debugFunction · 0.85
par_lockFunction · 0.85
par_read_controlFunction · 0.85
par_write_controlFunction · 0.85
par_unlockFunction · 0.85

Tested by

no test coverage detected