mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-12 09:39:30 +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:
@@ -136,6 +136,7 @@ CPPSRC = main.cpp \
|
||||
matched_filter.cpp \
|
||||
proc_jammer.cpp \
|
||||
proc_fsk_lcr.cpp \
|
||||
proc_xylos.cpp \
|
||||
dsp_squelch.cpp \
|
||||
clock_recovery.cpp \
|
||||
packet_builder.cpp \
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "baseband_processor.hpp"
|
||||
#include "proc_fsk_lcr.hpp"
|
||||
#include "proc_jammer.hpp"
|
||||
#include "proc_xylos.hpp"
|
||||
|
||||
#include "clock_recovery.hpp"
|
||||
#include "packet_builder.hpp"
|
||||
@@ -512,6 +513,11 @@ int main(void) {
|
||||
direction = baseband::Direction::Transmit;
|
||||
baseband_thread.baseband_processor = new JammerProcessor();
|
||||
break;
|
||||
|
||||
case 19:
|
||||
direction = baseband::Direction::Transmit;
|
||||
baseband_thread.baseband_processor = new XylosProcessor();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "proc_fsk_lcr.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
#include "sine_table.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -76,7 +77,7 @@ void LCRFSKProcessor::execute(buffer_c8_t buffer) {
|
||||
s++;
|
||||
}
|
||||
|
||||
//sample = sine_table_f32[(aphase & 0x00FF0000)>>16];
|
||||
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*255);
|
||||
|
||||
//FM
|
||||
frq = sample * shared_memory.afsk_fmmod;
|
||||
@@ -84,8 +85,8 @@ void LCRFSKProcessor::execute(buffer_c8_t buffer) {
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (256<<16);
|
||||
|
||||
//re = sine_table_f32[(sphase & 0x00FF0000)>>16];
|
||||
//im = sine_table_f32[(phase & 0x00FF0000)>>16];
|
||||
re = (sine_table_f32[(sphase & 0x03FF0000)>>18]*127);
|
||||
im = (sine_table_f32[(phase & 0x03FF0000)>>18]*127);
|
||||
|
||||
buffer.p[i] = {(int8_t)re,(int8_t)im};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ void JammerProcessor::execute(buffer_c8_t buffer) {
|
||||
if (ir > 15) ir = 0;
|
||||
if (shared_memory.jammer_ranges[ir].active == true) break;
|
||||
}
|
||||
jammer_bw = shared_memory.jammer_ranges[ir].width / 4;
|
||||
jammer_bw = shared_memory.jammer_ranges[ir].width / 2;
|
||||
|
||||
message.freq = shared_memory.jammer_ranges[ir].center;
|
||||
shared_memory.application_queue.push(message);
|
||||
@@ -89,7 +89,7 @@ void JammerProcessor::execute(buffer_c8_t buffer) {
|
||||
}
|
||||
|
||||
aphase += 8830;
|
||||
sample = sine_table_f32[(aphase & 0x00FF0000)>>16];
|
||||
sample = sine_table_f32[(aphase & 0x03FF0000)>>18]*256;
|
||||
|
||||
//FM
|
||||
frq = sample * jammer_bw; // Bandwidth
|
||||
@@ -97,8 +97,8 @@ void JammerProcessor::execute(buffer_c8_t buffer) {
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (256<<16);
|
||||
|
||||
re = sine_table_f32[(sphase & 0x00FF0000)>>16];
|
||||
im = sine_table_f32[(phase & 0x00FF0000)>>16];
|
||||
re = sine_table_f32[(sphase & 0x03FF0000)>>18]*127;
|
||||
im = sine_table_f32[(phase & 0x03FF0000)>>18]*127;
|
||||
|
||||
buffer.p[i] = {(int8_t)re,(int8_t)im};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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_xylos.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
#include "sine_table.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void XylosProcessor::execute(buffer_c8_t buffer) {
|
||||
|
||||
for (size_t i = 0; i<buffer.count; i++) {
|
||||
//Sample generation 2.28M/10 = 228kHz
|
||||
if (s >= 9) {
|
||||
s = 0;
|
||||
|
||||
if (sample_count >= CCIR_TONELENGTH) {
|
||||
if (shared_memory.xylos_transmit_done == false) {
|
||||
message.n = byte_pos; // Progress
|
||||
shared_memory.application_queue.push(message);
|
||||
digit = shared_memory.xylosdata[byte_pos++];
|
||||
}
|
||||
|
||||
if (!digit) {
|
||||
message.n = 25; // Done code
|
||||
shared_memory.xylos_transmit_done = true;
|
||||
shared_memory.application_queue.push(message);
|
||||
digit = 0;
|
||||
}
|
||||
|
||||
if (digit > '9') digit -= 7;
|
||||
digit -= 0x30;
|
||||
|
||||
sample_count = 0;
|
||||
} else {
|
||||
sample_count++;
|
||||
}
|
||||
|
||||
aphase += ccir_phases[digit];
|
||||
} else {
|
||||
s++;
|
||||
}
|
||||
|
||||
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*255);
|
||||
|
||||
//FM
|
||||
frq = sample * 160; // 20kHz wide (?)
|
||||
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (256<<16);
|
||||
|
||||
re = (sine_table_f32[(sphase & 0x03FF0000)>>18]*127);
|
||||
im = (sine_table_f32[(phase & 0x03FF0000)>>18]*127);
|
||||
|
||||
buffer.p[i] = {(int8_t)re,(int8_t)im};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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_XYLOS_H__
|
||||
#define __PROC_XYLOS_H__
|
||||
|
||||
#include "baseband_processor.hpp"
|
||||
|
||||
#define CCIR_TONELENGTH 22800
|
||||
#define PHASEV 294.34
|
||||
|
||||
class XylosProcessor : public BasebandProcessor {
|
||||
public:
|
||||
void execute(buffer_c8_t buffer) override;
|
||||
|
||||
private:
|
||||
uint32_t ccir_phases[16] = {
|
||||
1981*PHASEV,
|
||||
1124*PHASEV,
|
||||
1197*PHASEV,
|
||||
1275*PHASEV,
|
||||
1358*PHASEV,
|
||||
1446*PHASEV,
|
||||
1540*PHASEV,
|
||||
1640*PHASEV,
|
||||
1747*PHASEV,
|
||||
1860*PHASEV,
|
||||
2400*PHASEV,
|
||||
930*PHASEV,
|
||||
2247*PHASEV,
|
||||
991*PHASEV,
|
||||
2110*PHASEV,
|
||||
1055*PHASEV
|
||||
};
|
||||
|
||||
int8_t re, im;
|
||||
uint8_t s;
|
||||
uint8_t byte_pos = 0;
|
||||
uint8_t digit = 0;
|
||||
uint32_t sample_count = CCIR_TONELENGTH;
|
||||
uint32_t aphase, phase, sphase;
|
||||
int32_t sample, frq;
|
||||
TXDoneMessage message;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user