Documentation
¶
Index ¶
- Constants
- Variables
- func CRC(in []byte) uint16
- func CalculateHammingDistance(a, b uint32) int
- func CalculateSyndrome(codeword uint32) uint16
- func DecodeCallsign(encoded []byte) (string, error)
- func DecodeLICH(inp []SoftBit) []byte
- func Encode24(data uint16) uint32
- func EncodeLICH(inp []uint8) []byte
- func EuclNorm(s1, s2 []Symbol, n int) float64
- func GetErrorCorrectionCapability() int
- func GetMinimumDistance() int
- func HardDecode24(codeword uint32) (uint16, error)
- func IntToSoft(out []SoftBit, value uint16, size uint8)
- func IsValidCodeword(codeword uint32) bool
- func NormalizeCallsignModule(callsign string) string
- func SoftCalcChecksum(out, value []SoftBit)
- func SoftDecode24(codeword [24]SoftBit) uint16
- func SoftDetectErrors(codeword []SoftBit) uint32
- func SoftPopCount(in []uint16, size uint8) uint32
- func SoftToInt(in []SoftBit, size uint8) uint16
- func SoftXOR(out, a, b []SoftBit, size uint8)
- type BatchFMModulator
- type BatchResampler
- type Bit
- type CC1200Modem
- func (m *CC1200Modem) Close() error
- func (m *CC1200Modem) Reset() error
- func (m *CC1200Modem) Start() error
- func (m *CC1200Modem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
- func (m *CC1200Modem) TransmitPacket(p Packet) error
- func (m *CC1200Modem) TransmitVoiceStream(sd StreamDatagram) error
- type ComplexDCRemoval
- type Converter
- type DCFilter
- type DashboardLogger
- type Decoder
- type Downsampler
- type DummyModem
- func (m *DummyModem) Close() error
- func (m *DummyModem) Read(p []byte) (n int, err error)
- func (m *DummyModem) Reset() error
- func (m *DummyModem) SetAFC(afc bool) error
- func (m *DummyModem) SetFreqCorrection(corr int16) error
- func (m *DummyModem) SetRXFreq(freq uint32) error
- func (m *DummyModem) SetTXFreq(freq uint32) error
- func (m *DummyModem) SetTXPower(dbm float32) error
- func (m *DummyModem) Start() error
- func (m *DummyModem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
- func (m *DummyModem) TransmitPacket(p Packet) error
- func (m *DummyModem) TransmitVoiceStream(sd StreamDatagram) error
- func (m *DummyModem) Write(buf []byte) (n int, err error)
- type ECD
- type EncodedCallsign
- type FMDemodulator
- type GNSS
- type Host
- type Hostfile
- type IIRFilter
- type InetClient
- type LSF
- func (l *LSF) CAN() byte
- func (l *LSF) CalcCRC() uint16
- func (l *LSF) CheckCRC() bool
- func (l *LSF) DataType() LSFDataType
- func (l *LSF) ECD() *ECD
- func (l *LSF) EncryptionSubtype() byte
- func (l *LSF) EncryptionType() LSFEncryptionType
- func (l *LSF) GNSS() *GNSS
- func (l *LSF) LSFType() LSFType
- func (l *LSF) SetECD(slot1, slot2 *EncodedCallsign)
- func (l LSF) String() string
- func (l *LSF) ToBytes() []byte
- func (l *LSF) ToLSDBytes() []byte
- type LSFDataType
- type LSFEncryptionType
- type LSFType
- type MMDVMConfig
- type MMDVMModem
- func (m *MMDVMModem) Close() error
- func (m *MMDVMModem) Reset() error
- func (m *MMDVMModem) Start() error
- func (m *MMDVMModem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
- func (m *MMDVMModem) TransmitPacket(p Packet) error
- func (m *MMDVMModem) TransmitVoiceStream(sd StreamDatagram) error
- type MaxAbsDecimator
- type Modem
- type Number
- type Packet
- type PacketType
- type PayloadBits
- type PolyphaseDecimator
- type Preamble
- type PuncturePattern
- type RationalResampler
- type SX1255Modem
- func (m *SX1255Modem) Close() error
- func (m *SX1255Modem) Reset() error
- func (m *SX1255Modem) Start() error
- func (m *SX1255Modem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
- func (m *SX1255Modem) TransmitPacket(p Packet) error
- func (m *SX1255Modem) TransmitVoiceStream(sd StreamDatagram) error
- type SampleToSymbol
- type Scaler
- type SoftBit
- type StreamDatagram
- type Symbol
- type SymbolToSample
- type TXPulseShaper
- type Transform
- type ViterbiDecoder
Constants ¶
const ( SymbolsPerSyncword = 8 //symbols per syncword SymbolsPerPayload = 184 //symbols per payload in a frame SymbolsPerFrame = 192 //symbols per whole 40 ms frame, 40ms * 4800 = 192 BytesPerFrame = SymbolsPerFrame * BitsPerSymbol / 8 BitsPerSymbol = 2 BitsPerPayload = SymbolsPerPayload * BitsPerSymbol FrameTime = 40 * time.Millisecond FramesPerSecond = time.Second / FrameTime )
const ( PacketModeFinalBit = 5 // use 6 bits of final byte LSFFinalBit = 7 // use entire final byte )
const ( ConvolutionK = 5 //constraint length K=5 ConvolutionStates = (1 << (ConvolutionK - 1)) //number of states of the convolutional encoder )
const ( LSFSync = uint16(0x55F7) StreamSync = uint16(0xFF5D) PacketSync = uint16(0x75FF) BERTSync = uint16(0xDF55) EOTMarker = uint16(0x555D) )
const ( EncodedCallsignLen = 6 MaxCallsignLen = 9 DestinationAll = "@ALL" EncodedDestinationAll = 0xFFFFFFFFFFFF MaxEncodedCallsign = 0xEE6B27FFFFFF SpecialEncodedRange = 268697600000000 //40^9+40^8 )
const ( // SoftZero represents a confident 0 bit SoftZero = 0x0000 // SoftOne represents a confident 1 bit SoftOne = 0xFFFF // SoftErasure represents an uncertain/erased bit SoftErasure = 0x7FFF // SoftThreshold is the decision boundary SoftThreshold = 0x7FFF )
Constants for soft-decision logic
const ( MagicLen = 4 MagicACKN = "ACKN" MagicCONN = "CONN" MagicDISC = "DISC" MagicLSTN = "LSTN" MagicNACK = "NACK" MagicPING = "PING" MagicPONG = "PONG" MagicM17Stream = "M17 " MagicM17Packet = "M17P" )
const ( LSFLen = 30 LSDLen = 28 )
const ( RXSymbolScalingCoeff = (1.0 / (0.8 / (40.0e3 / 2097152 * 0xAD) * 130.0)) TXSymbolScalingCoeff = (0.8 / ((40.0e3 / 2097152) * 0xAD) * 64.0) )
const CRCLen = 2
const ErrorDetectionFailed = 0xFFFFFFFF
ErrorDetectionFailed indicates the decoder could not correct the errors
Variables ¶
var ( // TX symbols SymbolMap = []Symbol{+1, +3, -1, -3} // symbol list (RX) SymbolList = []Symbol{-3, -1, +1, +3} // End of Transmission symbol pattern EOTSymbols = []Symbol{+3, +3, +3, +3, +3, +3, -3, +3} )
var ( LSFPreambleSymbols = []float64{+3, -3, +3, -3, +3, -3, +3, -3} LSFSyncSymbols = []float64{+3, +3, +3, +3, -3, -3, +3, -3} // 0x55F7 ExtLSFSyncSymbols = append(LSFPreambleSymbols, LSFSyncSymbols...) StreamSyncSymbols = []float64{-3, -3, -3, -3, +3, +3, -3, +3} // 0xFF5D PacketSyncSymbols = []float64{+3, -3, +3, +3, -3, -3, -3, -3} // 0x75FF BERTSyncSymbols = []float64{-3, +3, -3, -3, +3, +3, +3, +3} // 0xDF55 EOTMarkerSymbols = []float64{+3, +3, +3, +3, +3, +3, -3, +3} // 0x555D )
var ( LSFSyncBytes = []byte{0x55, 0xF7} StreamSyncBytes = []byte{0xFF, 0x5D} PacketSyncBytes = []byte{0x75, 0xFF} BERTSyncBytes = []byte{0xDF, 0x55} EOTMarkerBytes = []byte{0x55, 0x5D} )
var ( ErrMMDVMReadTimeout = errors.New("read timeout") ErrUnsupportedModemProtocol = errors.New("unsupported MMDVM protocol version") ErrModemNAK = errors.New("modem returned NAK") )
var CallsignRegex = regexp.MustCompile(`([a-zA-Z0-9]{1,3}/)?[a-zA-Z0-9]{1,3}[0-9][a-zA-Z0-9]{0,3}[a-zA-Z](/[a-zA-Z0-9]{1,3})?`)
var EncodedDestinationAllBytes = EncodedCallsign{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
var LSFPuncturePattern = PuncturePattern{ true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, true, false, true, true, }
var PacketPuncturePattern = PuncturePattern{true, true, true, true, true, true, true, false}
Functions ¶
func CalculateHammingDistance ¶
CalculateHammingDistance calculates the Hamming distance between two codewords
func CalculateSyndrome ¶
CalculateSyndrome calculates the syndrome for error detection
func DecodeCallsign ¶
func DecodeLICH ¶
DecodeLICH decodes LICH into a 6-byte array inp: pointer to an array of 96 soft bits
func Encode24 ¶
Encode24 encodes a 12-bit value with Golay(24, 12) data: 12-bit input value (right justified) returns: 24-bit Golay codeword
func EncodeLICH ¶
EncodeLICH encodes 6 bytes into 12 bytes using Golay encoding
func GetErrorCorrectionCapability ¶
func GetErrorCorrectionCapability() int
GetErrorCorrectionCapability returns the maximum number of errors that can be corrected
func GetMinimumDistance ¶
func GetMinimumDistance() int
GetMinimumDistance returns the minimum Hamming distance of the code
func HardDecode24 ¶
HardDecode24 performs hard-decision decoding of a Golay(24,12) codeword This is a simpler version that works with hard bits (0 or 1)
func IsValidCodeword ¶
IsValidCodeword checks if a 24-bit word is a valid Golay codeword
func NormalizeCallsignModule ¶
For regular callsigns, if the callsign ends with a space followed by a module letter, put the module letter in position 9 (the convention) with spaces preceding it
func SoftCalcChecksum ¶
func SoftCalcChecksum(out, value []SoftBit)
SoftCalcChecksum calculates checksum for soft-valued data This follows the C implementation exactly
func SoftDecode24 ¶
SoftDecode24 performs soft decode of Golay(24, 12) codeword
func SoftDetectErrors ¶
SoftDetectErrors detects errors in a soft-valued Golay(24, 12) codeword
func SoftPopCount ¶
SoftPopCount performs soft-valued equivalent of popcount
Types ¶
type BatchFMModulator ¶ added in v0.5.0
type BatchFMModulator struct {
// contains filtered or unexported fields
}
BatchFMModulator converts a real-valued baseband signal (representing frequency deviation) to complex IQ samples via FM modulation. Phase accumulates continuously across calls for seamless multi-frame TX.
The input signal is scaled such that a value of 1.0 corresponds to deviationHz Hz of frequency deviation. For M17 4FSK:
symbol +1 → +800 Hz, symbol +3 → +2400 Hz
So deviationHz should be 800.0, and the RRC output (which equals the symbol values at optimal sample points) maps directly to the correct deviation.
func NewBatchFMModulator ¶ added in v0.5.0
func NewBatchFMModulator(sampleRate float64) *BatchFMModulator
NewBatchFMModulator creates an FM modulator for the given sample rate.
func (*BatchFMModulator) Modulate ¶ added in v0.5.0
func (fm *BatchFMModulator) Modulate(baseband []float64, deviationHz float64) []complex128
Modulate converts baseband samples to complex IQ via FM modulation. deviationHz is the deviation in Hz per unit of input (e.g., 800.0 for M17). Output length = len(baseband).
func (*BatchFMModulator) Reset ¶ added in v0.5.0
func (fm *BatchFMModulator) Reset()
Reset clears the phase accumulator for a new transmission.
type BatchResampler ¶ added in v0.5.0
type BatchResampler struct {
// contains filtered or unexported fields
}
BatchResampler performs polyphase rational resampling on a batch of samples. Output rate = input rate * interpFactor / decimFactor. State persists across calls for waveform continuity.
func NewBatchResampler ¶ added in v0.5.0
func NewBatchResampler(interpFactor, decimFactor int) *BatchResampler
NewBatchResampler creates a batch rational resampler. For 24000 → 125000 Hz, use interp=125, decim=24.
func (*BatchResampler) Process ¶ added in v0.5.0
func (r *BatchResampler) Process(input []float64) []float64
Process resamples a batch of input samples. Output length ≈ len(input) * interpFactor / decimFactor.
func (*BatchResampler) Reset ¶ added in v0.5.0
func (r *BatchResampler) Reset()
Reset clears the delay line for a new transmission.
type Bit ¶
type Bit bool
func ConvolutionalEncode ¶
func ConvolutionalEncode(in []byte, puncturePattern PuncturePattern, finalBit byte) ([]Bit, error)
ConvolutionalEncode takes a slice of bytes and a puncture pattern and returns an a slice of bool with each element representing one bit in the encoded message
in Input bytes puncturePattern the puncture pattern to use finalBit The last bit of the final byte to encode. A number between 0 and 7. (That is, the number of bits from the last byte to use minus one.)
func ConvolutionalEncodeStream ¶
func ConvolutionalEncodeStream(lichBits []Bit, sd StreamDatagram) ([]Bit, error)
type CC1200Modem ¶
type CC1200Modem struct {
// contains filtered or unexported fields
}
func NewCC1200Modem ¶
func (*CC1200Modem) Start ¶
func (m *CC1200Modem) Start() error
func (*CC1200Modem) StartDecoding ¶ added in v0.2.0
func (m *CC1200Modem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
func (*CC1200Modem) TransmitPacket ¶
func (m *CC1200Modem) TransmitPacket(p Packet) error
func (*CC1200Modem) TransmitVoiceStream ¶
func (m *CC1200Modem) TransmitVoiceStream(sd StreamDatagram) error
type ComplexDCRemoval ¶ added in v0.5.0
type ComplexDCRemoval struct {
Transform[complex128, complex128]
// contains filtered or unexported fields
}
ComplexDCRemoval removes DC offset from a complex IQ stream using an exponential moving average high-pass filter applied independently to I and Q.
func NewComplexDCRemoval ¶ added in v0.5.0
func NewComplexDCRemoval(sink chan complex128, alpha float64) ComplexDCRemoval
type DashboardLogger ¶ added in v0.3.3
func NewDashboardLogger ¶ added in v0.3.3
func NewDashboardLogger(l *slog.Logger) *DashboardLogger
func (*DashboardLogger) Log ¶ added in v0.3.3
func (l *DashboardLogger) Log(logType string, logSubtype string, addlArgs ...any)
func (*DashboardLogger) LogFrame ¶ added in v0.3.3
func (l *DashboardLogger) LogFrame(lsf *LSF, logType string, logSubtype string, addlArgs ...any)
func (*DashboardLogger) LogGNSS ¶ added in v0.3.3
func (l *DashboardLogger) LogGNSS(lsf *LSF, logType string)
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func NewDecoder( receivedRFLSF func(lsf LSF, ber float64) error, receivedRFStream func(lsf LSF, payload []byte, sid, fn uint16, ber float64) error, receivedRFStreamLICH func(lsf LSF, ber float64) error, receivedRFStreamEOT func(lsf LSF, sid, fn uint16, ber float64) error, receivedRFPacket func(lsf LSF, payload []byte, ber float64) error, ) *Decoder
func (*Decoder) DecodeFrame ¶ added in v0.2.0
type Downsampler ¶
Downsample a stream by returning one out of each N values
func NewDownsampler ¶
func NewDownsampler[T any](sink chan T, factor int, offset int) (Downsampler[T], error)
type DummyModem ¶
type DummyModem struct {
In io.ReadCloser
Out io.WriteCloser
// contains filtered or unexported fields
}
func (*DummyModem) Close ¶
func (m *DummyModem) Close() error
func (*DummyModem) Reset ¶
func (m *DummyModem) Reset() error
func (*DummyModem) SetAFC ¶
func (m *DummyModem) SetAFC(afc bool) error
func (*DummyModem) SetFreqCorrection ¶
func (m *DummyModem) SetFreqCorrection(corr int16) error
func (*DummyModem) SetRXFreq ¶
func (m *DummyModem) SetRXFreq(freq uint32) error
func (*DummyModem) SetTXFreq ¶
func (m *DummyModem) SetTXFreq(freq uint32) error
func (*DummyModem) SetTXPower ¶
func (m *DummyModem) SetTXPower(dbm float32) error
func (*DummyModem) Start ¶
func (m *DummyModem) Start() error
func (*DummyModem) StartDecoding ¶ added in v0.2.0
func (m *DummyModem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
func (*DummyModem) TransmitPacket ¶
func (m *DummyModem) TransmitPacket(p Packet) error
func (*DummyModem) TransmitVoiceStream ¶
func (m *DummyModem) TransmitVoiceStream(sd StreamDatagram) error
type ECD ¶ added in v0.1.21
type ECD struct {
Callsign1 *EncodedCallsign
Callsign2 *EncodedCallsign
}
func NewECDFromMeta ¶ added in v0.1.21
type EncodedCallsign ¶
type EncodedCallsign [EncodedCallsignLen]byte
func EncodeCallsign ¶
func EncodeCallsign(callsign string) (*EncodedCallsign, error)
func (EncodedCallsign) Callsign ¶
func (e EncodedCallsign) Callsign() string
type FMDemodulator ¶ added in v0.5.0
type FMDemodulator struct {
Transform[complex128, float64]
// contains filtered or unexported fields
}
FMDemodulator extracts instantaneous frequency from a complex IQ stream using the conjugate-multiply-and-arg method. Output is in radians per sample.
func NewFMDemodulator ¶ added in v0.5.0
func NewFMDemodulator(sink chan complex128) FMDemodulator
type GNSS ¶ added in v0.1.21
type GNSS struct {
DataSource byte
StationType byte
Radius byte
Bearing uint16
Latitude float32
Longitude float32
Altitude float32
Speed float32
ValidLatLon bool
ValidAltitude bool
ValidBearingSpeed bool
ValidRadius bool
}
func NewGNSSFromMeta ¶ added in v0.1.21
type Hostfile ¶ added in v0.1.7
func NewHostfile ¶ added in v0.1.7
type IIRFilter ¶ added in v0.2.10
IIRFilter represents a simple first-order IIR filter
func NewIIRFilter ¶ added in v0.2.10
NewIIRFilter initializes and returns a new IIR filter
type InetClient ¶ added in v0.4.0
type InetClient struct {
Name string
Server string
Port uint
Module byte
EncodedName *EncodedCallsign
// contains filtered or unexported fields
}
func NewInetClient ¶ added in v0.4.0
func NewInetClient(name string, server string, port uint, module string, callsign string, dashLog *DashboardLogger, packetHandler func(Packet) error, streamHandler func(StreamDatagram) error) (*InetClient, error)
func (*InetClient) Close ¶ added in v0.4.0
func (r *InetClient) Close() error
func (*InetClient) Connect ¶ added in v0.4.0
func (r *InetClient) Connect() error
func (*InetClient) SendPacket ¶ added in v0.4.0
func (r *InetClient) SendPacket(p Packet) error
func (*InetClient) SendStream ¶ added in v0.4.0
func (r *InetClient) SendStream(sd StreamDatagram) error
type LSF ¶
type LSF struct {
Dst EncodedCallsign
Src EncodedCallsign
Type [typeLen]byte
Meta [metaLen]byte
CRC [CRCLen]byte
}
Link Setup Frame
func NewEmptyLSF ¶
func NewEmptyLSF() LSF
func NewLSFFromBytes ¶
func NewLSFFromLSD ¶
func (*LSF) DataType ¶ added in v0.1.21
func (l *LSF) DataType() LSFDataType
func (*LSF) EncryptionSubtype ¶ added in v0.1.21
func (*LSF) EncryptionType ¶ added in v0.1.21
func (l *LSF) EncryptionType() LSFEncryptionType
func (*LSF) SetECD ¶ added in v0.2.11
func (l *LSF) SetECD(slot1, slot2 *EncodedCallsign)
Replace META with Extended Callsign Data
func (*LSF) ToLSDBytes ¶
Convert this LSF to a byte slice suitable for transmission
type LSFDataType ¶
type LSFDataType byte
const ( LSFDataTypeReserved LSFDataType = iota LSFDataTypeData LSFDataTypeVoice LSFDataTypeVoiceData )
func (LSFDataType) String ¶ added in v0.1.21
func (t LSFDataType) String() string
type LSFEncryptionType ¶
type LSFEncryptionType byte
const ( LSFEncryptionTypeNone LSFEncryptionType = iota LSFEncryptionTypeScrambler LSFEncryptionTypeAES LSFEncryptionTypeOther )
func (LSFEncryptionType) String ¶ added in v0.1.21
func (t LSFEncryptionType) String() string
type MMDVMConfig ¶ added in v0.2.0
type MMDVMConfig struct {
// contains filtered or unexported fields
}
type MMDVMModem ¶ added in v0.2.0
type MMDVMModem struct {
// contains filtered or unexported fields
}
func NewMMDVMModem ¶ added in v0.2.0
func (*MMDVMModem) Start ¶ added in v0.2.0
func (m *MMDVMModem) Start() error
func (*MMDVMModem) StartDecoding ¶ added in v0.2.0
func (m *MMDVMModem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
func (*MMDVMModem) TransmitPacket ¶ added in v0.2.0
func (m *MMDVMModem) TransmitPacket(p Packet) error
func (*MMDVMModem) TransmitVoiceStream ¶ added in v0.2.0
func (m *MMDVMModem) TransmitVoiceStream(sd StreamDatagram) error
type MaxAbsDecimator ¶ added in v0.5.0
type MaxAbsDecimator struct {
Transform[float32, float32]
// contains filtered or unexported fields
}
MaxAbsDecimator reduces the sample rate by picking the sample with the largest absolute value from each group of N input samples. This performs a simple form of symbol clock recovery: the RRC-filtered symbol peak has the largest magnitude, so picking max-abs approximates optimal timing.
func NewMaxAbsDecimator ¶ added in v0.5.0
func NewMaxAbsDecimator(sink chan float32, factor int) MaxAbsDecimator
type Number ¶
type Number interface {
constraints.Integer | constraints.Float
}
type Packet ¶
type Packet struct {
LSF *LSF
Type PacketType
Payload []byte
CRC uint16
}
M17 packet
func NewPacketFromBytes ¶
func (*Packet) PayloadBytes ¶
Convert the payload (type, message and CRC) to a byte slice suitable for transmission
type PacketType ¶
type PacketType rune
const ( PacketTypeRAW PacketType = 0x00 PacketTypeAX25 PacketType = 0x01 PacketTypeAPRS PacketType = 0x02 PacketType6LoWPAN PacketType = 0x03 PacketTypeIPv4 PacketType = 0x04 PacketTypeSMS PacketType = 0x05 PacketTypeWinlink PacketType = 0x06 )
type PayloadBits ¶ added in v0.2.0
type PayloadBits [BitsPerPayload]Bit
func NewPayloadBits ¶ added in v0.2.0
func NewPayloadBits(bs []Bit) *PayloadBits
func RandomizeBits ¶
func RandomizeBits(bits *PayloadBits) *PayloadBits
type PolyphaseDecimator ¶ added in v0.5.0
type PolyphaseDecimator struct {
Transform[complex128, complex128]
// contains filtered or unexported fields
}
PolyphaseDecimator performs efficient decimation with FIR filtering using a polyphase decomposition. The input is complex IQ; the output is complex IQ at a lower sample rate. The FIR acts as a lowpass anti-alias/channel filter.
The full-rate FIR H(z) is decomposed into M subfilters E_0..E_{M-1}. For each block of M input samples, ONE output is produced:
y[n] = Σ_{p=0}^{M-1} Σ_{k} E_p[k] · x[nM − p − kM]
All M input samples contribute to the output through their respective phase subfilters, providing proper anti-alias filtering before decimation.
func NewPolyphaseDecimator ¶ added in v0.5.0
func NewPolyphaseDecimator(sink chan complex128, taps []float64, decimFactor int) PolyphaseDecimator
NewPolyphaseDecimator creates a polyphase decimating FIR filter. taps is the full prototype lowpass FIR filter (length should be a multiple of decimFactor). decimFactor is the decimation ratio.
type PuncturePattern ¶
type PuncturePattern []Bit
type RationalResampler ¶ added in v0.5.0
type RationalResampler struct {
Transform[float64, float64]
// contains filtered or unexported fields
}
RationalResampler converts between sample rates using a polyphase FIR filter. Output rate = input rate * interpFactor / decimFactor. The prototype lowpass filter runs at interpFactor × the input rate.
func NewRationalResampler ¶ added in v0.5.0
func NewRationalResampler(sink chan float64, interpFactor, decimFactor int) RationalResampler
NewRationalResampler creates a rational resampler. interpFactor/decimFactor is the rate change ratio. For 12500 → 24000 Hz, use interp=48, decim=25.
type SX1255Modem ¶ added in v0.5.0
type SX1255Modem struct {
// contains filtered or unexported fields
}
SX1255Modem implements the Modem interface for the SX1255 RF transceiver HAT. Unlike MMDVM and CC1200 modems which have on-board microcontrollers, the SX1255 is a raw IQ analog front-end — all baseband DSP is performed in software.
The SX1255 supports full-duplex operation: RX runs continuously even during TX.
func NewSX1255Modem ¶ added in v0.5.0
func NewSX1255Modem( rxFrequency uint32, txFrequency uint32, modemCfg *ini.Section, ) (*SX1255Modem, error)
NewSX1255Modem creates and initializes an SX1255 modem from INI configuration.
func (*SX1255Modem) Close ¶ added in v0.5.0
func (m *SX1255Modem) Close() error
Close shuts down the SX1255 modem, releasing all resources.
func (*SX1255Modem) Reset ¶ added in v0.5.0
func (m *SX1255Modem) Reset() error
Reset performs a hardware reset of the SX1255 chip and re-initializes it.
func (*SX1255Modem) Start ¶ added in v0.5.0
func (m *SX1255Modem) Start() error
Start enables the RX path.
func (*SX1255Modem) StartDecoding ¶ added in v0.5.0
func (m *SX1255Modem) StartDecoding(sink func(typ uint16, softBits []SoftBit))
StartDecoding registers the frame sink callback and starts the symbol processing goroutine.
func (*SX1255Modem) TransmitPacket ¶ added in v0.5.0
func (m *SX1255Modem) TransmitPacket(p Packet) error
TransmitPacket sends a packet over RF. Full-duplex: RX continues running during TX.
func (*SX1255Modem) TransmitVoiceStream ¶ added in v0.5.0
func (m *SX1255Modem) TransmitVoiceStream(sd StreamDatagram) error
TransmitVoiceStream sends a voice stream frame over RF. Full-duplex: RX continues running during TX.
type SampleToSymbol ¶
type SampleToSymbol struct {
Transform[float64, float32]
// contains filtered or unexported fields
}
Transform int8 samples to float32 symbols by RRC filtering them
func NewSampleToSymbol ¶
func NewSampleToSymbol(sink chan float64, rrcTaps []float64, scalingCoeff float64) SampleToSymbol
func (*SampleToSymbol) Source ¶
func (t *SampleToSymbol) Source() chan float32
type SoftBit ¶
type SoftBit uint16
func DeinterleaveSoftBits ¶
func DerandomizeSoftBits ¶
func SoftBitXOR ¶
SoftBitXOR performs XOR operation on soft-valued bits This should match the C test expectations exactly
type StreamDatagram ¶
type StreamDatagram struct {
StreamID uint16
FrameNumber uint16
LastFrame bool
LSF *LSF
Payload [16]byte
}
func NewStreamDatagram ¶
func NewStreamDatagram(streamID uint16, frameNumber uint16, lsf *LSF, payload []byte) StreamDatagram
func NewStreamDatagramFromBytes ¶ added in v0.1.23
func NewStreamDatagramFromBytes(buffer []byte) (StreamDatagram, error)
func (StreamDatagram) String ¶ added in v0.1.23
func (sd StreamDatagram) String() string
func (StreamDatagram) ToBytes ¶ added in v0.1.23
func (sd StreamDatagram) ToBytes() []byte
type Symbol ¶
type Symbol float32
func AppendBits ¶
func AppendBits(out []Symbol, data *PayloadBits) []Symbol
func AppendPreamble ¶
AppendPreamble generates symbol stream for a preamble.
func AppendSyncwordSymbols ¶ added in v0.2.0
AppendSyncwordSymbols generates the symbol stream for a syncword.
type SymbolToSample ¶
type SymbolToSample struct {
// contains filtered or unexported fields
}
Transform float32 symbols to int8 samples
func NewSymbolToSample ¶
func NewSymbolToSample(rrcTaps []float64, scalingCoeff float32, phaseInvert bool, samplesPerSymbol int) SymbolToSample
func (*SymbolToSample) Transform ¶
func (t *SymbolToSample) Transform(symbols []Symbol) []byte
type TXPulseShaper ¶ added in v0.5.0
type TXPulseShaper struct {
// contains filtered or unexported fields
}
TXPulseShaper performs RRC pulse shaping on M17 symbols, producing samplesPerSymbol output samples per input symbol. State persists across calls so that consecutive invocations produce a continuous waveform.
Algorithm: for each symbol, insert the symbol value followed by (samplesPerSymbol-1) zeros into a delay line, then convolve with the RRC FIR taps to produce each output sample.
func NewTXPulseShaper ¶ added in v0.5.0
func NewTXPulseShaper(taps []float64, sps int) *TXPulseShaper
NewTXPulseShaper creates a new TX pulse shaper. taps is the RRC filter (e.g., rrcTaps5), sps is samples per symbol (e.g., 5).
func (*TXPulseShaper) Process ¶ added in v0.5.0
func (p *TXPulseShaper) Process(symbols []Symbol) []float64
Process converts a batch of symbols to pulse-shaped baseband samples. Output length = len(symbols) * samplesPerSymbol.
func (*TXPulseShaper) Reset ¶ added in v0.5.0
func (p *TXPulseShaper) Reset()
Reset clears the delay line for a new transmission.
type ViterbiDecoder ¶
type ViterbiDecoder struct {
// contains filtered or unexported fields
}
func (*ViterbiDecoder) DecodePunctured ¶
func (v *ViterbiDecoder) DecodePunctured(puncturedSoftBits []SoftBit, puncturePattern PuncturePattern) ([]byte, int)
func (*ViterbiDecoder) Init ¶
func (v *ViterbiDecoder) Init(l int)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
m17-bridge
command
|
|
|
m17-gateway
command
|
|
|
m17-message
command
|
|
|
m17-text-cli
command
|
|
|
modem-emulator
command
|
|