Skip to content

Commit

Permalink
composites/bpsk31receiver: add BPSK31Receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
vsergeev committed Jul 29, 2016
1 parent fde77b2 commit 3be684a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions radio/composites/bpsk31receiver.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
-- Demodulate and decode bytes from a baseband BPSK31 modulated complex-valued
-- signal.
--
-- @category Receivers
-- @block BPSK31Receiver
--
-- @signature in:ComplexFloat32 > out:Byte
--
-- @usage
-- local receiver = radio.BPSK31Receiver()
-- local snk = radio.RawFileSink(io.stdout)
-- top:connect(src, receiver, snk)

local block = require('radio.core.block')
local types = require('radio.types')
local blocks = require('radio.blocks')

local BPSK31Receiver = block.factory("BPSK31Receiver", blocks.CompositeBlock)

function BPSK31Receiver:instantiate()
blocks.CompositeBlock.instantiate(self)

local bandwidth = 100
local baudrate = 31.25

local filter = blocks.LowpassFilterBlock(128, bandwidth)
local rrc_filter = blocks.RootRaisedCosineFilterBlock(101, 1, baudrate)
local phase_corrector = blocks.BinaryPhaseCorrectorBlock(50)
local clock_demod = blocks.ComplexToRealBlock()
local clock_recoverer = blocks.ZeroCrossingClockRecoveryBlock(baudrate)
local sampler = blocks.SamplerBlock()
local bit_demod = blocks.ComplexToRealBlock()
local slicer = blocks.SlicerBlock()
local bit_decoder = blocks.DifferentialDecoderBlock(true)
local decoder = blocks.VaricodeDecoderBlock()

self:connect(filter, rrc_filter, phase_corrector)
self:connect(phase_corrector, clock_demod, clock_recoverer)
self:connect(phase_corrector, 'out', sampler, 'data')
self:connect(clock_recoverer, 'out', sampler, 'clock')
self:connect(sampler, bit_demod, slicer, bit_decoder, decoder)

self:add_type_signature({block.Input("in", types.ComplexFloat32)}, {block.Output("out", types.Byte)})
self:connect(self, "in", filter, "in")
self:connect(self, "out", decoder, "out")
end

return BPSK31Receiver
1 change: 1 addition & 0 deletions radio/composites/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ return {
RDSReceiver = require('radio.composites.rdsreceiver'),
AX25Receiver = require('radio.composites.ax25receiver'),
POCSAGReceiver = require('radio.composites.pocsagreceiver'),
BPSK31Receiver = require('radio.composites.bpsk31receiver'),
}

0 comments on commit 3be684a

Please sign in to comment.