Skip to content

Instantly share code, notes, and snippets.

Created July 30, 2019 21:03
What would you like to do?
Example LimeRFE WSRP PTT control script
import ctypes
from ctypes import *
import sys
import os
import time
import datetime
import limeRFE_H as LH
libLimeSuite = ctypes.cdll.LoadLibrary('/usr/local/lib64/')
baudrate = 9600
# Open port
fd = libLimeSuite.LIMERFE_Open(c_char_p(b"/dev/ttyUSB0"), c_int(baudrate));
if (fd == -1):
print(stderr, "Error initializing serial port\n")
cinfo = (c_ubyte*4)()
print("Port opened; fd =", fd)
# Configure LimeRFE to use channel HAM 2m channel in receive mode.
# Transmit output is routed to TX output. Notch is off. Attenuation is 0.
#libLimeSuite.LIMERFE_Configure(c_int(LH.LIMERFE_USB), c_int(0), c_int(0), c_int(fd), c_int(LH.CID_HAM_0030), c_int(LH.TX2TXRX_INDEX_TX), c_int(LH.NOTCH_VALUE_OFF), c_int(0))
# Change mode to transmit
#libLimeSuite.LIMERFE_Mode(c_int(LH.LIMERFE_USB), c_int(0), c_int(0), c_int(fd), c_int(LH.RFE_MODE_TX))
while True:
t = datetime.datetime.utcnow()
s = t.minute * 60 + t.second
x = s % (4 * 60)
if x > 4 * 60 - 3 or x < 2 * 60:
print('PTT on')
libLimeSuite.LIMERFE_Mode(c_int(LH.LIMERFE_USB), c_int(0), c_int(0), c_int(fd), c_int(LH.RFE_MODE_TX))
print('PTT off')
libLimeSuite.LIMERFE_Mode(c_int(LH.LIMERFE_USB), c_int(0), c_int(0), c_int(fd), c_int(LH.RFE_MODE_RX))
# Reset LimeRFE
# Close port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment