mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-29 17:49:14 -04:00
Started work on ADS-B TX baseband processor
This commit is contained in:
parent
596071e8f8
commit
ef0feae62b
15 changed files with 413 additions and 82 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
|
@ -21,7 +22,7 @@
|
|||
|
||||
#include "proc_jammer.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
#include "sine_table.hpp"
|
||||
#include "sine_table_int8.hpp"
|
||||
#include "event_m4.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -29,6 +30,9 @@
|
|||
#define POLY_MASK_32 0xB4BCD35C
|
||||
|
||||
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
if (!configured) return;
|
||||
|
||||
for (size_t i = 0; i<buffer.count; i++) {
|
||||
|
||||
if (s >= 10000) { //shared_memory.jammer_ranges[ir].duration
|
||||
|
@ -66,21 +70,68 @@ void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
|||
}
|
||||
|
||||
aphase += 8830;
|
||||
sample = sine_table_f32[(aphase & 0x03FF0000)>>18]*256;
|
||||
sample = sine_table_i8[(sphase & 0x03FC0000) >> 18];
|
||||
|
||||
//FM
|
||||
frq = sample * jammer_bw; // Bandwidth
|
||||
// FM
|
||||
frq = sample * jammer_bw;
|
||||
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (256<<16);
|
||||
sphase = phase + (64 << 18);
|
||||
|
||||
re = sine_table_f32[(sphase & 0x03FF0000)>>18]*127;
|
||||
im = sine_table_f32[(phase & 0x03FF0000)>>18]*127;
|
||||
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
||||
im = (sine_table_i8[(phase & 0x03FC0000) >> 18]);
|
||||
|
||||
buffer.p[i] = {(int8_t)re,(int8_t)im};
|
||||
buffer.p[i] = {(int8_t)re, (int8_t)im};
|
||||
}
|
||||
};
|
||||
|
||||
void JammerProcessor::on_message(const Message* const msg) {
|
||||
/*const auto message = *reinterpret_cast<const DTMFTXConfigMessage*>(msg);
|
||||
|
||||
if (message.id == Message::ID::DTMFTXConfig) {
|
||||
|
||||
// Translate DTMF message to index in DTMF frequencies table
|
||||
tone_ptr = &shared_memory.tx_data[0];
|
||||
for (;;) {
|
||||
tone_code = *tone_ptr;
|
||||
if (tone_code == 0xFF)
|
||||
break; // End of message
|
||||
else if (tone_code <= 9)
|
||||
// That's already fine bro.
|
||||
*tone_ptr = tone_code;
|
||||
else if (tone_code == 'A')
|
||||
*tone_ptr = 10;
|
||||
else if (tone_code == 'B')
|
||||
*tone_ptr = 11;
|
||||
else if (tone_code == 'C')
|
||||
*tone_ptr = 12;
|
||||
else if (tone_code == 'D')
|
||||
*tone_ptr = 13;
|
||||
else if (tone_code == '#')
|
||||
*tone_ptr = 14;
|
||||
else if (tone_code == '*')
|
||||
*tone_ptr = 15;
|
||||
else {
|
||||
*tone_ptr = 0xFF; // Invalid character, stop here
|
||||
}
|
||||
tone_ptr++;
|
||||
}
|
||||
|
||||
// 1<<18 = 262144
|
||||
// m = (262144 * a) / 1536000
|
||||
// a = 262144 / 1536000 (*1000 = 171)
|
||||
bw = 171 * (message.bw);
|
||||
tone_length = message.tone_length * 154; // 153.6
|
||||
pause_length = message.pause_length * 154; // 153.6
|
||||
as = 0;
|
||||
tone = false;
|
||||
timer = 0;
|
||||
tone_idx = 0;
|
||||
|
||||
configured = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
int main() {
|
||||
EventDispatcher event_dispatcher { std::make_unique<JammerProcessor>() };
|
||||
event_dispatcher.run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue