mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-23 06:07:55 +00:00
Xylos (CCIR tones) TX, jammer update, SD card mod load
Xylos TX (CCIR tones) ;) Jammer update, still buggy and inefficient SD card module loader update
This commit is contained in:
@@ -140,6 +140,8 @@ CPPSRC = main.cpp \
|
||||
proc_ais.cpp \
|
||||
proc_wideband_spectrum.cpp \
|
||||
proc_tpms.cpp \
|
||||
proc_afskrx.cpp \
|
||||
proc_sigfrx.cpp \
|
||||
dsp_squelch.cpp \
|
||||
clock_recovery.cpp \
|
||||
packet_builder.cpp \
|
||||
|
@@ -180,6 +180,79 @@ constexpr fir_taps_real<64> taps_64_lp_130_169_tfilter {
|
||||
} },
|
||||
};
|
||||
|
||||
// 41kHz/70kHz @ 192kHz
|
||||
// http://t-filter.appspot.com
|
||||
constexpr fir_taps_real<64> taps_64_lp_410_700_tfilter {
|
||||
.pass_frequency_normalized = 0.213f,
|
||||
.stop_frequency_normalized = 0.364f,
|
||||
.taps = { {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
3,
|
||||
-3,
|
||||
-7,
|
||||
12,
|
||||
10,
|
||||
-35,
|
||||
-3,
|
||||
79,
|
||||
-37,
|
||||
-138,
|
||||
146,
|
||||
180,
|
||||
-361,
|
||||
-126,
|
||||
688,
|
||||
-149,
|
||||
-1062,
|
||||
800,
|
||||
1308,
|
||||
-1991,
|
||||
-1092,
|
||||
3963,
|
||||
-286,
|
||||
-7710,
|
||||
6211,
|
||||
32368,
|
||||
32368,
|
||||
6211,
|
||||
-7710,
|
||||
-286,
|
||||
3963,
|
||||
-1092,
|
||||
-1991,
|
||||
1308,
|
||||
800,
|
||||
-1062,
|
||||
-149,
|
||||
688,
|
||||
-126,
|
||||
-361,
|
||||
180,
|
||||
146,
|
||||
-138,
|
||||
-37,
|
||||
79,
|
||||
-3,
|
||||
-35,
|
||||
10,
|
||||
12,
|
||||
-7,
|
||||
-3,
|
||||
3,
|
||||
0,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
} },
|
||||
};
|
||||
|
||||
/* Wideband audio filter */
|
||||
/* 96kHz int16_t input
|
||||
* -> FIR filter, <15kHz (0.156fs) pass, >19kHz (0.198fs) stop
|
||||
|
@@ -57,9 +57,11 @@
|
||||
#include "proc_am_audio.hpp"
|
||||
#include "proc_nfm_audio.hpp"
|
||||
#include "proc_wfm_audio.hpp"
|
||||
#include "proc_ais.hpp"
|
||||
//#include "proc_ais.hpp"
|
||||
#include "proc_wideband_spectrum.hpp"
|
||||
#include "proc_tpms.hpp"
|
||||
//#include "proc_tpms.hpp"
|
||||
#include "proc_afskrx.hpp"
|
||||
#include "proc_sigfrx.hpp"
|
||||
|
||||
#include "clock_recovery.hpp"
|
||||
#include "packet_builder.hpp"
|
||||
@@ -356,7 +358,7 @@ void ram_loop_fn(void) {
|
||||
void wait_for_switch(void) {
|
||||
memcpy(&ram_loop[0], reinterpret_cast<char*>(&ram_loop_fn), 32);
|
||||
loop_ptr = reinterpret_cast<fn_ptr>(&ram_loop[0]);
|
||||
ReadyForSwitchMessage message { true };
|
||||
ReadyForSwitchMessage message;
|
||||
shared_memory.application_queue.push(message);
|
||||
(*loop_ptr)();
|
||||
return;
|
||||
@@ -402,19 +404,29 @@ int main(void) {
|
||||
baseband_thread.baseband_processor = new WidebandFMAudio();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/*case 3:
|
||||
direction = baseband::Direction::Receive;
|
||||
baseband_thread.baseband_processor = new AISProcessor();
|
||||
break;
|
||||
break;*/
|
||||
|
||||
case 4:
|
||||
direction = baseband::Direction::Receive;
|
||||
baseband_thread.baseband_processor = new WidebandSpectrum();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/*case 5:
|
||||
direction = baseband::Direction::Receive;
|
||||
baseband_thread.baseband_processor = new TPMSProcessor();
|
||||
break;*/
|
||||
|
||||
case 6:
|
||||
direction = baseband::Direction::Receive;
|
||||
baseband_thread.baseband_processor = new AFSKRXProcessor();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
direction = baseband::Direction::Receive;
|
||||
baseband_thread.baseband_processor = new SIGFRXProcessor();
|
||||
break;
|
||||
|
||||
case 0xFF:
|
||||
|
122
firmware/baseband/proc_afskrx.cpp
Normal file
122
firmware/baseband/proc_afskrx.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "proc_afskrx.hpp"
|
||||
#include "sine_table.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
using namespace lpc43xx;
|
||||
|
||||
void AFSKRXProcessor::execute(buffer_c8_t buffer) {
|
||||
/* Called every 2048/3072000 second -- 1500Hz. */
|
||||
|
||||
auto decimator_out = decimator.execute(buffer);
|
||||
|
||||
const buffer_c16_t work_baseband_buffer {
|
||||
(complex16_t*)decimator_out.p,
|
||||
sizeof(*decimator_out.p) * decimator_out.count
|
||||
};
|
||||
|
||||
/* 96kHz complex<int16_t>[64]
|
||||
* -> FIR filter, <6kHz (0.063fs) pass, gain 1.0
|
||||
* -> 48kHz int16_t[32] */
|
||||
auto channel = channel_filter.execute(decimator_out, work_baseband_buffer);
|
||||
|
||||
const buffer_s16_t work_audio_buffer {
|
||||
(int16_t*)decimator_out.p,
|
||||
sizeof(*decimator_out.p) * decimator_out.count
|
||||
};
|
||||
|
||||
/* 48kHz complex<int16_t>[32]
|
||||
* -> FM demodulation
|
||||
* -> 48kHz int16_t[32] */
|
||||
auto audio = demod.execute(channel, work_audio_buffer);
|
||||
|
||||
/*static uint64_t audio_present_history = 0;
|
||||
const auto audio_present_now = squelch.execute(audio);
|
||||
audio_present_history = (audio_present_history << 1) | (audio_present_now ? 1 : 0);
|
||||
const bool audio_present = (audio_present_history != 0);
|
||||
*/
|
||||
//if( !audio_present ) {
|
||||
// Zero audio buffer.
|
||||
/*for(size_t i=0; i<audio.count; i++) {
|
||||
if ((i % 3) > 1)
|
||||
audio.p[i] = 4096;
|
||||
else
|
||||
audio.p[i] = -4096;
|
||||
}*/
|
||||
//}
|
||||
|
||||
audio_hpf.execute_in_place(audio);
|
||||
|
||||
for(size_t i=0; i<audio.count; i++) {
|
||||
if (spur > 10) {
|
||||
if (audio.p[i] > 2000)
|
||||
sign = 1;
|
||||
if (audio.p[i] < -2000)
|
||||
sign = 0;
|
||||
spur = 0;
|
||||
} else {
|
||||
spur++;
|
||||
}
|
||||
if (sign != prev_sign) {
|
||||
if (freq_timer < 15) // 48
|
||||
bit = 0;
|
||||
else
|
||||
bit++;
|
||||
freq_timer = 0;
|
||||
}
|
||||
prev_sign = sign;
|
||||
if (freq_timer < 1000) freq_timer++; // TODO: Limit in a more intelligent way
|
||||
}
|
||||
|
||||
if (bit_timer >= 40) {
|
||||
bit_timer = 0;
|
||||
// Check bit state here !
|
||||
} else {
|
||||
bit_timer++;
|
||||
}
|
||||
|
||||
if (sc >= 600) {
|
||||
sc = 0;
|
||||
AFSKDataMessage message;
|
||||
memcpy(message.data,aud,128*2);
|
||||
shared_memory.application_queue.push(message);
|
||||
audc = 0;
|
||||
} else {
|
||||
sc++;
|
||||
}
|
||||
|
||||
if (audc < 4) {
|
||||
memcpy(aud+(audc*32),audio.p,32*2);
|
||||
audc++;
|
||||
}
|
||||
|
||||
fill_audio_buffer(audio);
|
||||
}
|
||||
|
||||
void AFSKRXProcessor::data_handler(
|
||||
const double data
|
||||
) {
|
||||
/*AFSKDataMessage message;
|
||||
message.data = 'T';
|
||||
shared_memory.application_queue.push(message);*/
|
||||
}
|
68
firmware/baseband/proc_afskrx.hpp
Normal file
68
firmware/baseband/proc_afskrx.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PROC_AFSKRX_H__
|
||||
#define __PROC_AFSKRX_H__
|
||||
|
||||
#include "baseband_processor.hpp"
|
||||
|
||||
#include "channel_decimator.hpp"
|
||||
#include "dsp_decimate.hpp"
|
||||
#include "dsp_demodulate.hpp"
|
||||
#include "dsp_fir_taps.hpp"
|
||||
#include "dsp_iir.hpp"
|
||||
#include "dsp_iir_config.hpp"
|
||||
#include "dsp_squelch.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <bitset>
|
||||
|
||||
class AFSKRXProcessor : public BasebandProcessor {
|
||||
public:
|
||||
AFSKRXProcessor() {
|
||||
decimator.set_decimation_factor(ChannelDecimator::DecimationFactor::By32);
|
||||
channel_filter.configure(channel_filter_taps.taps, 2);
|
||||
}
|
||||
|
||||
void execute(buffer_c8_t buffer) override;
|
||||
|
||||
private:
|
||||
ChannelDecimator decimator;
|
||||
const fir_taps_real<64>& channel_filter_taps = taps_64_lp_042_078_tfilter;
|
||||
dsp::decimate::FIRAndDecimateComplex channel_filter;
|
||||
dsp::demodulate::FM demod { 48000, 5000 };
|
||||
|
||||
IIRBiquadFilter audio_hpf { audio_hpf_config };
|
||||
//FMSquelch squelch;
|
||||
|
||||
uint16_t bit_timer = 0, freq_timer = 0;
|
||||
uint16_t sc;
|
||||
uint8_t audc, spur, sign, prev_sign, bit = 0;
|
||||
|
||||
int16_t aud[128];
|
||||
|
||||
void data_handler(const double data);
|
||||
};
|
||||
|
||||
#endif/*__PROC_TPMS_H__*/
|
Reference in New Issue
Block a user