hackrf

package
v0.0.0-...-68a81b4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: BSD-3-Clause Imports: 5 Imported by: 3

Documentation

Overview

Package hackrf provides an interface to the HackRF SDR hardware.

This package wraps libhackrf using cgo.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidParam        = errors.New("hackrf: invalid param")
	ErrNotFound            = errors.New("hackrf: not found")
	ErrBusy                = errors.New("hackrf: busy")
	ErrNoMem               = errors.New("hackrf: no mem")
	ErrLibUSB              = errors.New("hackrf: libusb error")
	ErrThread              = errors.New("hackrf: thread error")
	ErrStreamingThreadErr  = errors.New("hackrf: streaming thread error")
	ErrStreamingStopped    = errors.New("hackrf: streaming stopped")
	ErrStreamingExitCalled = errors.New("hackrf: streaming exit called")
	ErrOther               = errors.New("hackrf: other error")
)

Functions

func ComputeBasebandFilterBW

func ComputeBasebandFilterBW(bandwidthHz int) int

ComputeBasebandFilterBWRoundDownLT computes the best default value depending on sample rate (auto filter)

func ComputeBasebandFilterBWRoundDownLT

func ComputeBasebandFilterBWRoundDownLT(bandwidthHz int) int

ComputeBasebandFilterBWRoundDownLT computse the nearest freq for bw filter (manual filter)

func Exit

func Exit() error

Exit should be called once at the end of the program.

func Init

func Init() error

Init must be called once at the start of the program.

func LibraryRelease

func LibraryRelease() string

func LibraryVersion

func LibraryVersion() string

Types

type Callback

type Callback func(buf []byte) error

type Device

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

func Open

func Open() (*Device, error)

Open returns the HackRF device which provides access to the hardware.

func (*Device) Close

func (d *Device) Close() error

func (*Device) SetAmpEnable

func (d *Device) SetAmpEnable(value bool) error

SetAmpEnable enables or disables the external RX/TX RF amplifier.

func (*Device) SetAntennaEnable

func (d *Device) SetAntennaEnable(enabled bool) error

SetAntennaEnable enables ot disables antenna port power

func (*Device) SetBasebandFilterBandwidth

func (d *Device) SetBasebandFilterBandwidth(hz int) error

SetBasebandFilterBandwidth sets the baseband bandwidth. Possible values are 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz.

func (*Device) SetFreq

func (d *Device) SetFreq(freqHz uint64) error

func (*Device) SetLNAGain

func (d *Device) SetLNAGain(value int) error

SetLNAGain sets the gain for the RX low-noise amplifier (IF). Range 0-40 step 8db

func (*Device) SetSampleRate

func (d *Device) SetSampleRate(freqHz float64) error

SetSampleRate sets the sample rate in hz. Preferred rates are 8, 10, 12.5, 16, 20MHz due to less jitter.

func (*Device) SetSampleRateManual

func (d *Device) SetSampleRateManual(freqHz, divider int) error

SetSampleRateManual sets the sample rate in hz. Preferred rates are 8, 10, 12.5, 16, 20MHz due to less jitter.

func (*Device) SetTXVGAGain

func (d *Device) SetTXVGAGain(value int) error

SetTXVGAGain sets the gain for the TX variable gain amplifier (IF). Range 0-47 step 1db

func (*Device) SetVGAGain

func (d *Device) SetVGAGain(value int) error

SetVGAGain sets the gain for the RX variable gain amplifier (baseband). Range 0-62 step 2db

func (*Device) StartRX

func (d *Device) StartRX(cb Callback) error

StartRX starts sampling sending the IQ samples to the callback.

func (*Device) StartTX

func (d *Device) StartTX(cb Callback) error

func (*Device) StopRX

func (d *Device) StopRX() error

func (*Device) StopTX

func (d *Device) StopTX() error

func (*Device) Version

func (d *Device) Version() (string, error)

type DeviceInfo

type DeviceInfo struct {
	SerialNumber   string
	USBBoardID     USBBoardID
	USBDeviceIndex int
}

func DeviceList

func DeviceList() ([]*DeviceInfo, error)

type ErrUnknown

type ErrUnknown int

func (ErrUnknown) Error

func (e ErrUnknown) Error() string

type USBBoardID

type USBBoardID uint16
const (
	USBBoardIDJawbreaker USBBoardID = 0x604B
	USBBoardIDHackRFOne  USBBoardID = 0x6089
	USBBoardIDRad1o      USBBoardID = 0xCC15
	USBBoardIDInvalid    USBBoardID = 0xFFFF
)

func (USBBoardID) String

func (u USBBoardID) String() string

Jump to

Keyboard shortcuts

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