limedrv

package module
v0.0.0-...-fa2c926 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

Build Status Apache License Go Report

MOVED TO https://github.com/myriadrf/limedrv

limedrv

LimeSuite Wrapper on Go (Driver for LimeSDR Devices)

Usage

So far I need to do all the comments for the methods (since go auto-generates the documentation). But while I do that, you can check the examples. The documentation is available at: https://godoc.org/github.com/racerxdl/limedrv

Examples

So far there is a functional WBFM Radio that uses SegDSP for demodulating. You can check it at _examples/limefm. To compile, just go to the folder and run:

go build

It will generate a limefm executable in the folder. It outputs the raw Float32 audio into stdout. For example, you can listen to the radio by using ffplay:

./limefm -antenna LNAL -centerFrequency 106300000 -channel 0 -gain 0.5 -outputRate 48000 | ffplay -f f32le -ar 48k -ac 1 -

Documentation

Overview

limedrv is a LMS7 API Wrapper to Go made to be easy to use. Currently this documentation is WIP. Some examples are available in _examples folder.

Index

Constants

View Source
const (
	// ChannelA represents the ID of Channel A in LMS Devices ( = 0 )
	ChannelA = 0

	// ChannelB represents the ID of Channel B in LMS Devices ( = 1 )
	ChannelB = 1
)

Preset of channel IDs by name. To be used in channel calls.

View Source
const (
	// RX Antennas
	LNAW = "LNAW"
	LNAH = "LNAH"
	LNAL = "LNAL"

	// Loopback Antennas (works for both RX and TX)
	LB1 = "LB1"
	LB2 = "LB2"

	// TX Antennas
	BAND1 = "BAND1"
	BAND2 = "BAND2"

	// Not connected
	NONE = "NONE"
)

Preset of Antenna Names to be used in SetAntennaByName

Variables

View Source
var (
	// FormatFloat32 defines the output of LMS Device to have samples using 32 bit float
	FormatFloat32 = limewrap.Lms_stream_tLMS_FMT_F32
	// FormatInt16 defines the output of LMS Device to have samples using 16 bit int
	FormatInt16 = limewrap.Lms_stream_tLMS_FMT_I16
	// FormatInt12 defines the output of LMS Device to have samples using 12 bit int
	FormatInt12 = limewrap.Lms_stream_tLMS_FMT_I12
)

IQ Formats to be set in IQFormat of LMSDevice. This sets the communication between the LMS Device and the computer.

Functions

func Close

func Close(device *LMSDevice)

Close closes a LMSDevice. This makes the LMSDevice instance useless.

Types

type DeviceInfo

type DeviceInfo struct {
	DeviceName          string
	Media               string
	Module              string
	Addr                string
	Serial              string
	ProtocolVersion     string
	FirmwareVersion     string
	HardwareVersion     string
	GatewareVersion     string
	GatewareTargetBoard string
	// contains filtered or unexported fields
}

DeviceInfo is a struct with driver information required to open a connection

func GetDevices

func GetDevices() []DeviceInfo

GetDevices return an array of available devices in the LMS7 driver.

type LMSAntenna

type LMSAntenna struct {
	Name             string
	Channel          int
	MinimumFrequency float64
	MaximumFrequency float64
	Step             float64
	// contains filtered or unexported fields
}

LMSAntenna is a struct that represents the Antenna Port information

func (*LMSAntenna) Set

func (a *LMSAntenna) Set()

Set sets this antenna port as the default in parent channel

func (*LMSAntenna) String

func (a *LMSAntenna) String() string

String returns a representation of the antenna port data

type LMSChannel

type LMSChannel struct {
	Antennas []LMSAntenna
	IsRX     bool
	// contains filtered or unexported fields
}

LMSChannel is the struct that represents a Channel from a LMSDevice. It can be either a RX or TX Channel, defined by the field IsRX. It also contains the list of available antenna ports.

func (*LMSChannel) Disable

func (c *LMSChannel) Disable() *LMSChannel

Disable disables this channel from the read / write callback

func (*LMSChannel) DisableDigitalLPF

func (c *LMSChannel) DisableDigitalLPF() *LMSChannel

DisableDigitalLPF disables current channel digital filter (GFIR)

func (*LMSChannel) DisableLPF

func (c *LMSChannel) DisableLPF() *LMSChannel

DisableLPF disables the Analog Low Pass filter for the current channel.

func (*LMSChannel) Enable

func (c *LMSChannel) Enable() *LMSChannel

Enable enables this channel from the read / write callback

func (*LMSChannel) EnableDigitalLPF

func (c *LMSChannel) EnableDigitalLPF() *LMSChannel

EnableDigitalLPF enables current channel digital filter (GFIR)

func (*LMSChannel) EnableLPF

func (c *LMSChannel) EnableLPF() *LMSChannel

EnableLPF enables the Analog Low Pass filter for the current channel.

func (*LMSChannel) GetCenterFrequency

func (c *LMSChannel) GetCenterFrequency() float64

GetCenterFrequency returns the current channel center frequency in hertz.

func (*LMSChannel) GetGainDB

func (c *LMSChannel) GetGainDB() uint

GetGainDB returns the channel current gain in decibels

func (*LMSChannel) GetGainNormalized

func (c *LMSChannel) GetGainNormalized() float64

GetGainNormalized returns the channel current normalized gain. [0-1]

func (*LMSChannel) GetLPF

func (c *LMSChannel) GetLPF() float64

GetLPF gets the current Analog Low Pass filter bandwidth for the current channel.

func (*LMSChannel) SetAntenna

func (c *LMSChannel) SetAntenna(idx int) *LMSChannel

SetAntenna sets the current channel antenna port

func (*LMSChannel) SetAntennaByName

func (c *LMSChannel) SetAntennaByName(name string) *LMSChannel

SetAntennaByName sets the current channel antenna port by name. Example: LNAW

func (*LMSChannel) SetCenterFrequency

func (c *LMSChannel) SetCenterFrequency(centerFrequency float64) *LMSChannel

SetCenterFrequency sets the current channel center frequency in hertz.

func (*LMSChannel) SetDigitalLPF

func (c *LMSChannel) SetDigitalLPF(bandwidth float64) *LMSChannel

SetDigitalLPF sets the current channel digital filter (GFIR) to low pass with specified bandwidth.

func (*LMSChannel) SetGainDB

func (c *LMSChannel) SetGainDB(gain uint) *LMSChannel

SetGainDB sets this channel gain in decibels

func (*LMSChannel) SetGainNormalized

func (c *LMSChannel) SetGainNormalized(gain float64) *LMSChannel

SetGainNormalized sets the channel normalized gain. [0-1]

func (*LMSChannel) SetLPF

func (c *LMSChannel) SetLPF(bandwidth float64) *LMSChannel

SetLPF sets the Analog Low Pass filter bandwidth for the current channel.

func (*LMSChannel) String

func (c *LMSChannel) String() string

String returns a representation of the channel

type LMSDevice

type LMSDevice struct {
	// DeviceInfo contains all Device Information Provided by the API
	DeviceInfo DeviceInfo
	// RXChannels represents all Receive Channels
	RXChannels []*LMSChannel
	// TXChannels represents all Transmit Channels
	TXChannels []*LMSChannel
	// MinimumSampleRate represents the minimum supported sample rate by the device in Hertz
	MinimumSampleRate float64
	// MaximumSampleRate represents the minimum supported sample rate by the device in Hertz
	MaximumSampleRate float64
	// IQFormat of the output data from the device. Defaults to FormatInt16.
	// Notice that the callback from LMSDevice always returns complex64 which is converted internally by limedrv.
	// This IQFormat only specifies what the driver receives from the device itself, reducing bus bandwidth.
	IQFormat int

	// RXLPFMaxFrequency is the maximum Analog Low Pass Filter Frequency Suported by the Receive Channels in Hertz
	RXLPFMaxFrequency float64
	// RXLPFMinFrequency is the minimum Analog Low Pass Filter Frequency Suported by the Receive Channels in Hertz
	RXLPFMinFrequency float64
	// TXLPFMaxFrequency is the maximum Analog Low Pass Filter Frequency Suported by the Transmit Channels in Hertz
	TXLPFMaxFrequency float64
	// TXLPFMinFrequency is the minimum Analog Low Pass Filter Frequency Suported by the Transmit Channels in Hertz
	TXLPFMinFrequency float64

	// Advanced is the object for advanced manipulation of the LMS Device itself. Use with care.
	Advanced LMSDeviceAdvanced
	// contains filtered or unexported fields
}

LMSDevice is a class representing a Open LimeSDR Device. Use limedrv.Open function to create an instance

func Open

func Open(device DeviceInfo) *LMSDevice

Open opens a device specified by a DeviceInfo instance and returns a reference to LMSDevice

func (*LMSDevice) Close

func (d *LMSDevice) Close()

Close closes the device connection with the hardware. This instance will be unusable after this call.

func (*LMSDevice) DisableChannel

func (d *LMSDevice) DisableChannel(channelNumber int, isRX bool)

DisableChannel disables a channel to be received in callback

func (*LMSDevice) DisableDigitalFilter

func (d *LMSDevice) DisableDigitalFilter(channelNumber int, isRX bool)

DisableDigitalFilter disables digital (GFIR) Low Pass filter for specified channel.

func (*LMSDevice) DisableLPF

func (d *LMSDevice) DisableLPF(channelNumber int, isRX bool)

DisableLPF disables the Analog Low Pass filter in the specified channel

func (*LMSDevice) EnableChannel

func (d *LMSDevice) EnableChannel(channelNumber int, isRX bool)

EnableChannel enables a channel to be received in callback

func (*LMSDevice) EnableDigitalFilter

func (d *LMSDevice) EnableDigitalFilter(channelNumber int, isRX bool)

EnableDigitalFilter enables the digital (GFIR) Low pass filter for specified channel.

func (*LMSDevice) EnableLPF

func (d *LMSDevice) EnableLPF(channelNumber int, isRX bool)

EnableLPF enables the Analog Low Pass filter in specified channel

func (*LMSDevice) GetCenterFrequency

func (d *LMSDevice) GetCenterFrequency(channelNumber int, isRX bool) (centerFrequency float64)

GetCenterFrequency gets the center frequency currently set in the channel.

func (*LMSDevice) GetGainDB

func (d *LMSDevice) GetGainDB(channelNumber int, isRX bool) (gain uint)

GetGainDB returns the currently set gain in specified channel

func (*LMSDevice) GetGainNormalized

func (d *LMSDevice) GetGainNormalized(channelNumber int, isRX bool) (gain float64)

GetGainNormalized returns the currently set gain in specified channel

func (*LMSDevice) GetLPF

func (d *LMSDevice) GetLPF(channelNumber int, isRX bool) (bandwidth float64)

GetLPF gets the analog Low Pass Filter bandwidth in Hertz

func (*LMSDevice) GetSampleRate

func (d *LMSDevice) GetSampleRate() (host float64, rf float64)

GetSampleRate returns both host sample rate and rf sample rate (defined by oversample) If a SetSampleRate has been called with samplerate of 1e6 and overSample of 8, This call will return 1e6 in host and 8e6 in rf.

func (*LMSDevice) GetTemperature

func (d *LMSDevice) GetTemperature() (temp float64)

GetTemperature returns the temperature in degrees celsius of the LMS Device

func (*LMSDevice) SetAntenna

func (d *LMSDevice) SetAntenna(antennaNumber, channelNumber int, isRX bool)

SetAntenna sets the input antenna for the specified channel.

func (*LMSDevice) SetAntennaByName

func (d *LMSDevice) SetAntennaByName(name string, channelNumber int, isRX bool)

SetAntennaByName sets the input antenna for the specified channel by using its representation name, for example LNAW

func (*LMSDevice) SetCallback

func (d *LMSDevice) SetCallback(cb func([]complex64, int, uint64))

endregion region Public Methods SetCallback sets the callback for samples.

func (*LMSDevice) SetCenterFrequency

func (d *LMSDevice) SetCenterFrequency(channelNumber int, isRX bool, centerFrequency float64)

SetCenterFrequency sets the center frequency of the channel in Hertz. Although two channels can have two different center frequencies, they share the same LO, because of that some hardware tricks are done to be able to work at different frequencies leading to a certain limit of how spaced these two channels can be.

func (*LMSDevice) SetDigitalFilter

func (d *LMSDevice) SetDigitalFilter(channelNumber int, isRX bool, bandwidth float64)

SetDigitalFilter sets the Digital (GFIR) Low Pass filter frequency for the specified channel. bandwidth in hertz Requires Sample Rate to be set before calling this.

func (*LMSDevice) SetGainDB

func (d *LMSDevice) SetGainDB(channelNumber int, isRX bool, gain uint)

SetGainDB Sets the gain of the channel to specified value in dB

func (*LMSDevice) SetGainNormalized

func (d *LMSDevice) SetGainNormalized(channelNumber int, isRX bool, gain float64)

SetGainNormalized sets the gain of the channel to specified normalized value [0-1] with 0 being no gain, 1 being maximum gain.

func (*LMSDevice) SetLPF

func (d *LMSDevice) SetLPF(channelNumber int, isRX bool, bandwidth float64)

SetLPF sets the analog Low Pass Filter bandwidth for the specified channel. bandwidth is passed in Hertz

func (*LMSDevice) SetSampleRate

func (d *LMSDevice) SetSampleRate(sampleRate float64, oversample int)

SetSampleRate sets the sampleRate for specified value. oversample sets the over sampling done in hardware. for example if you set 1e6 for the sample rate and a oversample to 8, the limesdr hardware will run at 8e6 sps and decimate by 8 before sending to the FPGA this way you can increase the resolution without affecting the bandwidth to the computer

func (*LMSDevice) Start

func (d *LMSDevice) Start()

Start starts the device loop

func (*LMSDevice) Stop

func (d *LMSDevice) Stop()

Stop stops the device loop

func (*LMSDevice) String

func (d *LMSDevice) String() string

String returns a string representing this device with information like name, channels, sample rate.

type LMSDeviceAdvanced

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

LMSDeviceAdvanced is a dummy structure just to separated the methods considered for "Advanced Usage" It does not have any data besides the methods to allow advanced settings of LMSDevice object.

func (*LMSDeviceAdvanced) DisableGFir

func (d *LMSDeviceAdvanced) DisableGFir(gFirIdx, channelNumber int, isRX bool)

DisableGFIR disables a manually set GFIR Taps in the channel

func (*LMSDeviceAdvanced) EnableGFir

func (d *LMSDeviceAdvanced) EnableGFir(gFirIdx, channelNumber int, isRX bool)

EnableGFIR enables a manually set GFIR Taps in the channel

func (*LMSDeviceAdvanced) SetDigitalFilterTaps

func (d *LMSDeviceAdvanced) SetDigitalFilterTaps(gFirIdx, channelNumber int, isRX bool, taps []float64)

SetDigitalFilterTaps allows to manually set the GFIR digital filter taps from a channel. For enabling / disabling the GFIR when setting manual taps please use EnableGFIR / DisableGFIR in Advanced Section

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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