hpsdr

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Credit/Fork

Forked by 26uk247 to add selectable 2 receive port capability for the TRX-DUO running Pavel Demin's red-pitaya-notes firmware. Credit to https://github.com/jancona for the original code

hpsdr - A Go library to support HPSDR radios including the Hermes-Lite 2

Limitations

This is just a start on a real HPSDR library, but it works for simple receive-only uses. See https://github.com/jancona/hpsdrconnector for an example.

Current limitations include:

  • Only the original HPSDR Protocol 1 is supported.
  • It has only been tested with the Hermes-Lite 2. Feel free to create issues with reports of success or failure using other hardware.
  • Transmitting is not supported.
  • The API is not yet stable.

Documentation

Index

Constants

View Source
const (
	DeviceUnknown = -1
	DeviceMetis   = iota
	DeviceHermes
	DeviceAngelia
	DeviceOrion
	DeviceOrion2
	DeviceHermesLite
	DeviceHermesLite2
	DevicePiSDR
	DeviceRedPitaya
)

Device identifiers

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Protocol           int
	Device             int
	Name               string
	SoftwareVersion    byte
	Status             byte
	SupportedReceivers int
	ADCs               int
	Network            struct {
		MacAddress net.HardwareAddr
		Address    *net.UDPAddr
	}
}

Device is a discovered network SDR

func DiscoverDevice

func DiscoverDevice(ip string) (*Device, error)

DiscoverDevice finds an SDR devices at a particular address

func DiscoverDevices

func DiscoverDevices() ([]*Device, error)

DiscoverDevices finds SDR devices on the network

type Radio

type Radio interface {
	Close()
	Device() Device
	// Receivers() []Receiver
	SendSamples([]TransmitSample) error
	SetOCOut(uint8)
	SetLNAGain(gain uint)
	SetSampleRate(speed uint) error
	SetTXFrequency(frequency uint)
	Start() error
	Stop() error
	TransmitSamplesPerMessage() uint
	// AddReceiver adds a new Receiver to the Radio and returns it
	AddReceiver(func([]ReceiveSample)) (Receiver, error)
}

Radio represents an HPSDR radio

type ReceiveSample

type ReceiveSample struct {
	I2 byte
	I1 byte
	I0 byte
	Q2 byte
	Q1 byte
	Q0 byte
	M1 byte
	M0 byte
}

ReceiveSample represents a single EP6 IQ sample from the radio

func (ReceiveSample) IFloat

func (rs ReceiveSample) IFloat() float32

IFloat returns the I value as a float

func (ReceiveSample) QFloat

func (rs ReceiveSample) QFloat() float32

QFloat returns the Q value as a float

type Receiver

type Receiver interface {
	// SetFrequency sets the receiver center frequency
	SetFrequency(frequency uint)
	// GetFrequency returns the receiver center frequency
	GetFrequency() uint
	// Close closes the receiver
	Close() error
	// IsClosed returns true if the receiver has been closed
	IsClosed() bool
}

Receiver represents an HPSDR receiver

type TransmitSample

type TransmitSample struct {
	Left  uint16
	Right uint16
	I     uint16
	Q     uint16
}

TransmitSample represents a single EP2 transmit sample sent to the radio

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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