Skip to content

Commit

Permalink
Adding an initial class to transmit packets using the Pluto SDR #110
Browse files Browse the repository at this point in the history
  • Loading branch information
mgm8 committed Jun 14, 2024
1 parent e6f11c5 commit 227212a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions spacelab_transmitter/pluto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# pluto.py
#
# Copyright The SpaceLab-Transmitter Contributors.
#
# This file is part of SpaceLab-Transmitter.
#
# SpaceLab-Transmitter is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# SpaceLab-Transmitter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with SpaceLab-Transmitter; if not, see <http://www.gnu.org/licenses/>.
#
#


import adi

class Pluto:
"""
PlutoSDR handler.
"""
def __init__(self, sample_rate, gain):
"""
Constructor.
:param sample_rate: Sample rate in S/s
:param gain: gain in dB (valid range is -90 to 0 dB)
"""
self._pluto = adi.Pluto("ip:192.168.2.1")
self._pluto.sample_rate = int(sample_rate)
self._pluto.tx_rf_bandwidth = int(sample_rate)
self._pluto.tx_hardwaregain_chan0 = gain

def transmit(self, samples, freq):
"""
Function to transmit IQ samples through the SDR device.
:param: samples: A NumPy array with the IQ data (complex).
:param: freq: is the frequency in Hz.
:return: None.
"""
self._pluto.tx_lo = int(freq)

self._pluto.tx(samples)

0 comments on commit 227212a

Please sign in to comment.