pluto

package
v0.0.0-...-9809d57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2023 License: MIT Imports: 11 Imported by: 1

README

ADALM-Pluto hz.tools/sdr driver

The PlutoSDR driver was one of second generation drivers originally written in late 2020, and rewritten around January of 2021. This has gone from being fairly unstable to one of the most robust and well supported SDR implementations in the suite.

It's combination of SampleRate range and 12 bit ADC are incredibly compelling tech.

Format Type I16
Receiver
Transmitter

Documentation

Overview

Package pluto contains an sdr.Sdr implementation for the Analog Devices ADALM-PLUTO SDR.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CyclicTx

type CyclicTx struct {
	// contains filtered or unexported fields
}

CyclicTx will transmit a specific buffer in a loop. If the buffer is to be updated after the fact, be sure to invoke 'Push'.

func (*CyclicTx) Close

func (ct *CyclicTx) Close() error

Close will cancel the context, and then wait for the cleanup routine to close out any resources it's holding on to.

func (*CyclicTx) Powerdown

func (ct *CyclicTx) Powerdown() error

Powerdown will turn off the transmit power.

func (*CyclicTx) Powerup

func (ct *CyclicTx) Powerup() error

Powerup will turn on the transmit power.

func (*CyclicTx) Push

func (ct *CyclicTx) Push() error

Push will update the PlutoSDR with the buffer provided when the CyclicTx was created.

type Options

type Options struct {
	// RxBufferLength defines the size of the buffer that is used to copy
	// samples into in the process of copying data out of the PlutoSDR.
	RxBufferLength int

	// TxBufferLength defines the size of the buffer that will be used to
	// copy samples into the process of writing data out of the PlutoSDR.
	TxBufferLength int

	// RxKernelBuffersCount controlls the number of kernelspace buffers that
	// are to be used for the rx channel. Leaving this at 0 will use the
	// iio default.
	RxKernelBuffersCount uint

	// TxKernelBuffersCount controlls the number of kernelspace buffers that
	// are to be used for the tx channel. Leaving this at 0 will use the
	// iio default.
	TxKernelBuffersCount uint

	// CheckOverruns will check to see if there's been an overrun when refilling
	// the IQ buffer.
	CheckOverruns bool
}

Options are the tunable knobs that control the behavior of the PlutoSDR driver.

type Sdr

type Sdr struct {
	// contains filtered or unexported fields
}

Sdr is an interface to the underlying PlutoSDR endpoint. This will allow the user to interact with the Pluto as any other hz.tools/sdr.Sdr. This implements both the Receiver and Transmitter (Transceiver) interface.

func Open

func Open(endpoint string) (*Sdr, error)

Open will create a PlutoSDR handle with the default set of options.

The endpoint string is the URI that would be passed to the iio* tools, such as ip:192.168.2.1, or ip:pluto3.hz.tools

func OpenWithOptions

func OpenWithOptions(endpoint string, opts Options) (*Sdr, error)

OpenWithOptions will establish a connection to a PlutoSDR, and return a handle to interact with that device. The endpoint string is the URI that would be passed to the iio* tools, such as ip:192.168.2.1, or ip:pluto3.hz.tools

func (*Sdr) Close

func (s *Sdr) Close() error

Close implements the sdr.Sdr interface.

func (*Sdr) GetCenterFrequency

func (s *Sdr) GetCenterFrequency() (rf.Hz, error)

GetCenterFrequency implements the sdr.Sdr interface.

func (*Sdr) GetGain

func (s *Sdr) GetGain(sdr.GainStage) (float32, error)

GetGain implements the sdr.Sdr interface.

func (*Sdr) GetGainStages

func (s *Sdr) GetGainStages() (sdr.GainStages, error)

GetGainStages implements the sdr.Sdr interface.

func (*Sdr) GetSampleRate

func (s *Sdr) GetSampleRate() (uint, error)

GetSampleRate implements the sdr.Sdr interface.

func (*Sdr) HardwareInfo

func (s *Sdr) HardwareInfo() sdr.HardwareInfo

HardwareInfo implements the sdr.Sdr interface

func (*Sdr) Loopback

func (p *Sdr) Loopback(ctx context.Context) (sdr.Reader, sdr.Writer, error)

Loopback will enable Pluto's Loopback mode, and return a TX and RX stream to be used like an sdr.Pipe. This will put your IQ data through the signal path and into your RX channel.

Loopback mode is only disabled on context cancel. Please remember to cancel your context!

func (*Sdr) SampleFormat

func (s *Sdr) SampleFormat() sdr.SampleFormat

SampleFormat implements the sdr.Sdr interface.

func (*Sdr) SetAutomaticGain

func (s *Sdr) SetAutomaticGain(autoGain bool) error

SetAutomaticGain implements the sdr.Sdr interface.

func (*Sdr) SetCenterFrequency

func (s *Sdr) SetCenterFrequency(r rf.Hz) error

SetCenterFrequency implements the sdr.Sdr interface.

func (*Sdr) SetGain

func (s *Sdr) SetGain(gainStage sdr.GainStage, gain float32) error

SetGain implements the sdr.Sdr interface.

func (*Sdr) SetLoopback

func (s *Sdr) SetLoopback(b bool) error

SetLoopback will set BIST Loopback to send TX data to the RX port.

func (*Sdr) SetSampleRate

func (s *Sdr) SetSampleRate(sps uint) error

SetSampleRate implements the sdr.Sdr interface.

func (*Sdr) StartCyclicTx

func (s *Sdr) StartCyclicTx(buf sdr.SamplesI16) (*CyclicTx, error)

StartCyclicTx allows for the creation of a cyclic transmit buffer, and to manage the updating of that buffer.

func (*Sdr) StartRx

func (s *Sdr) StartRx() (sdr.ReadCloser, error)

StartRx implements the sdr.Sdr interface.

func (*Sdr) StartTx

func (s *Sdr) StartTx() (sdr.WriteCloser, error)

StartTx implements the sdr.Sdr interface.

Directories

Path Synopsis
Package iio contains a Go wrapper around libiio, to talk with devices such as the Analog Devices ADALM-PLUTO.
Package iio contains a Go wrapper around libiio, to talk with devices such as the Analog Devices ADALM-PLUTO.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL