mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Udpdated jammer baseband code, should work again
This commit is contained in:
parent
368f0f7fb0
commit
7cb38f858e
@ -155,6 +155,13 @@ void set_adsb() {
|
|||||||
send_message(&message);
|
send_message(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_jammer() {
|
||||||
|
const JammerConfigureMessage message {
|
||||||
|
1
|
||||||
|
};
|
||||||
|
send_message(&message);
|
||||||
|
}
|
||||||
|
|
||||||
void set_rds_data(const uint16_t message_length) {
|
void set_rds_data(const uint16_t message_length) {
|
||||||
const RDSConfigureMessage message {
|
const RDSConfigureMessage message {
|
||||||
message_length
|
message_length
|
||||||
|
@ -65,6 +65,7 @@ void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit,
|
|||||||
const uint32_t pause_symbols);
|
const uint32_t pause_symbols);
|
||||||
void set_pocsag(const pocsag::BitRate bitrate);
|
void set_pocsag(const pocsag::BitRate bitrate);
|
||||||
void set_adsb();
|
void set_adsb();
|
||||||
|
void set_jammer();
|
||||||
void set_rds_data(const uint16_t message_length);
|
void set_rds_data(const uint16_t message_length);
|
||||||
//void set_dtmf_data(const uint32_t bw, const uint32_t tone_length, const uint32_t pause_length);
|
//void set_dtmf_data(const uint32_t bw, const uint32_t tone_length, const uint32_t pause_length);
|
||||||
|
|
||||||
|
@ -23,7 +23,12 @@
|
|||||||
// Color bitmaps generated with:
|
// Color bitmaps generated with:
|
||||||
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
|
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
|
||||||
|
|
||||||
//BUG: Bad console scroll init
|
//BUG: (fixed ?) Bad console scroll init
|
||||||
|
//BUG: POCSAG misses alphanum messages, cuts them off sometimes
|
||||||
|
//BUG: Jammer channels are wrong (not enough) when using multiple ranges
|
||||||
|
|
||||||
|
//TODO: Array for checkboxes and texts, options_preset "CUSTOM" on manual freq. entry, in jammer
|
||||||
|
//TODO: Digital mode for Waveform widget
|
||||||
|
|
||||||
//TEST: Imperial in whipcalc
|
//TEST: Imperial in whipcalc
|
||||||
//TEST: Numbers
|
//TEST: Numbers
|
||||||
|
@ -239,45 +239,6 @@ void EncodersView::on_type_change(size_t index) {
|
|||||||
format_string += ' ';
|
format_string += ' ';
|
||||||
|
|
||||||
text_format.set(format_string);
|
text_format.set(format_string);
|
||||||
|
|
||||||
/*word_format = encoder_def->word_format;
|
|
||||||
size_t address_start = word_format.find_first_of("A");
|
|
||||||
size_t data_start = word_format.find_first_of("D");
|
|
||||||
size_t format_length = word_format.length();
|
|
||||||
|
|
||||||
if (address_start == std::string::npos) address_start = format_length;
|
|
||||||
if (data_start == std::string::npos) data_start = format_length;
|
|
||||||
|
|
||||||
// Never did anything so dirty :(
|
|
||||||
if (!address_start) {
|
|
||||||
address_length = data_start;
|
|
||||||
data_length = format_length - address_length;
|
|
||||||
} else {
|
|
||||||
data_length = address_start;
|
|
||||||
address_length = format_length - data_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (address_length) {
|
|
||||||
text_format_a.hidden(false);
|
|
||||||
text_format_a.set_parent_rect(
|
|
||||||
{ (2 + address_start) * 8, 12 * 8, address_length * 8, 16 }
|
|
||||||
);
|
|
||||||
text_format_a.set_style(&style_address);
|
|
||||||
text_format_a.set(std::string(address_length, 'A'));
|
|
||||||
} else {
|
|
||||||
text_format_a.hidden(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data_length) {
|
|
||||||
text_format_d.hidden(false);
|
|
||||||
text_format_d.set_parent_rect(
|
|
||||||
{ (2 + data_start) * 8, 12 * 8, data_length * 8, 16 }
|
|
||||||
);
|
|
||||||
text_format_d.set_style(&style_data);
|
|
||||||
text_format_d.set(std::string(data_length, 'D'));
|
|
||||||
} else {
|
|
||||||
text_format_d.hidden(true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
generate_frame();
|
generate_frame();
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,11 @@ void JammerView::update_text(uint8_t id, rf::Frequency f) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JammerView::on_retune(const rf::Frequency freq) {
|
void JammerView::on_retune(const rf::Frequency freq, const uint32_t range) {
|
||||||
if (freq > 0)
|
if (freq) {
|
||||||
transmitter_model.set_tuning_frequency(freq);
|
transmitter_model.set_tuning_frequency(freq);
|
||||||
|
text_range_number.set(to_string_dec_uint(range, 2, ' '));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JammerView::JammerView(NavigationView& nav) {
|
JammerView::JammerView(NavigationView& nav) {
|
||||||
@ -102,14 +104,14 @@ JammerView::JammerView(NavigationView& nav) {
|
|||||||
|
|
||||||
static constexpr Style style_val {
|
static constexpr Style style_val {
|
||||||
.font = font::fixed_8x16,
|
.font = font::fixed_8x16,
|
||||||
.background = Color::green(),
|
.background = Color::black(),
|
||||||
.foreground = Color::black(),
|
.foreground = Color::green(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr Style style_cancel {
|
static constexpr Style style_cancel {
|
||||||
.font = font::fixed_8x16,
|
.font = font::fixed_8x16,
|
||||||
.background = Color::red(),
|
.background = Color::black(),
|
||||||
.foreground = Color::black(),
|
.foreground = Color::red(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr Style style_info {
|
static constexpr Style style_info {
|
||||||
@ -122,6 +124,7 @@ JammerView::JammerView(NavigationView& nav) {
|
|||||||
|
|
||||||
add_children({
|
add_children({
|
||||||
&text_type,
|
&text_type,
|
||||||
|
&text_range_number,
|
||||||
&options_modulation,
|
&options_modulation,
|
||||||
&text_sweep,
|
&text_sweep,
|
||||||
&options_sweep,
|
&options_sweep,
|
||||||
@ -189,78 +192,86 @@ JammerView::JammerView(NavigationView& nav) {
|
|||||||
button_transmit.on_select = [this, &nav, jammer_ranges](Button&) {
|
button_transmit.on_select = [this, &nav, jammer_ranges](Button&) {
|
||||||
uint8_t c, i = 0;
|
uint8_t c, i = 0;
|
||||||
size_t num_ranges;
|
size_t num_ranges;
|
||||||
rf::Frequency start_freq, range_bw, ch_width;
|
rf::Frequency start_freq, range_bw, range_bw_sub, ch_width;
|
||||||
bool out_of_ranges = false;
|
bool out_of_ranges = false;
|
||||||
|
|
||||||
// Disable all ranges by default
|
// Disable all ranges by default
|
||||||
for (i = 0; i < 9; i++)
|
for (c = 0; c < 9; c++)
|
||||||
jammer_ranges[i].enabled = false;
|
jammer_ranges[c].enabled = false;
|
||||||
|
|
||||||
// Generate jamming "channels", maximum: 9
|
// Generate jamming "channels", maximum: 9
|
||||||
// Convert ranges min/max to center/bw
|
// Convert ranges min/max to center/bw
|
||||||
for (c = 0; c < 3; c++) {
|
for (c = 0; c < 3; c++) {
|
||||||
|
|
||||||
range_bw = abs(frequency_range[c].max - frequency_range[c].min); // Total bw for range
|
range_bw = abs(frequency_range[c].max - frequency_range[c].min); // Total bw for range
|
||||||
if (frequency_range[c].min < frequency_range[c].max)
|
|
||||||
start_freq = frequency_range[c].min;
|
if (range_bw) {
|
||||||
else
|
// Sort
|
||||||
start_freq = frequency_range[c].max;
|
if (frequency_range[c].min < frequency_range[c].max)
|
||||||
if (range_bw > 500000) {
|
start_freq = frequency_range[c].min;
|
||||||
// Example: 600kHz
|
else
|
||||||
// int(600000 / 500000) = 2
|
start_freq = frequency_range[c].max;
|
||||||
// CH-BW = 600000 / 2 = 300000
|
|
||||||
// Center-A = min + CH-BW / 2 = 150000
|
if (range_bw > 500000) {
|
||||||
// BW-A = CH-BW = 300000
|
// Example: 600kHz
|
||||||
// Center-B = min + CH-BW + Center-A = 450000
|
// int(600000 / 500000) = 2
|
||||||
// BW-B = CH-BW = 300000
|
// CH-BW = 600000 / 2 = 300000
|
||||||
num_ranges = 0;
|
// Center-A = min + CH-BW / 2 = 150000
|
||||||
while (range_bw > 500000) {
|
// BW-A = CH-BW = 300000
|
||||||
range_bw -= 500000;
|
// Center-B = min + CH-BW + Center-A = 450000
|
||||||
num_ranges++;
|
// BW-B = CH-BW = 300000
|
||||||
}
|
num_ranges = 0;
|
||||||
ch_width = range_bw / num_ranges;
|
range_bw_sub = range_bw;
|
||||||
for (c = 0; c < num_ranges; c++) {
|
do {
|
||||||
|
range_bw_sub -= 500000;
|
||||||
|
num_ranges++;
|
||||||
|
} while (range_bw_sub > 500000);
|
||||||
|
ch_width = range_bw / num_ranges;
|
||||||
|
for (c = 0; c < num_ranges; c++) {
|
||||||
|
if (i >= 9) {
|
||||||
|
out_of_ranges = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
jammer_ranges[i].enabled = true;
|
||||||
|
jammer_ranges[i].width = ch_width;
|
||||||
|
jammer_ranges[i].center = start_freq + (ch_width / 2) + (ch_width * c);
|
||||||
|
jammer_ranges[i].duration = 15360 * options_hop.selected_index_value();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (i >= 9) {
|
if (i >= 9) {
|
||||||
out_of_ranges = true;
|
out_of_ranges = true;
|
||||||
break;
|
} else {
|
||||||
|
jammer_ranges[i].enabled = true;
|
||||||
|
jammer_ranges[i].width = range_bw;
|
||||||
|
jammer_ranges[i].center = start_freq + (range_bw / 2);
|
||||||
|
jammer_ranges[i].duration = 15360 * options_hop.selected_index_value();
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
jammer_ranges[i].enabled = true;
|
|
||||||
jammer_ranges[i].width = ch_width;
|
|
||||||
jammer_ranges[i].center = start_freq + (ch_width / 2) + (ch_width * c);
|
|
||||||
jammer_ranges[i].duration = 2280000 / 10; // ?
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (i >= 9) {
|
|
||||||
out_of_ranges = true;
|
|
||||||
} else {
|
|
||||||
jammer_ranges[i].enabled = true;
|
|
||||||
jammer_ranges[i].width = range_bw;
|
|
||||||
jammer_ranges[i].center = start_freq + (range_bw / 2);
|
|
||||||
jammer_ranges[i].duration = 2280000 / 10; // ?
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!out_of_ranges) {
|
|
||||||
if (jamming == true) {
|
if (!out_of_ranges) {
|
||||||
jamming = false;
|
if (jamming == true) {
|
||||||
button_transmit.set_style(&style_val);
|
jamming = false;
|
||||||
button_transmit.set_text("START");
|
button_transmit.set_style(&style_val);
|
||||||
radio::disable();
|
button_transmit.set_text("START");
|
||||||
} else {
|
radio::disable();
|
||||||
jamming = true;
|
|
||||||
button_transmit.set_style(&style_cancel);
|
|
||||||
button_transmit.set_text("STOP");
|
|
||||||
|
|
||||||
//transmitter_model.set_tuning_frequency(433920000); // TODO
|
|
||||||
transmitter_model.set_sampling_rate(1536000U);
|
|
||||||
transmitter_model.set_rf_amp(true);
|
|
||||||
transmitter_model.set_baseband_bandwidth(1750000);
|
|
||||||
transmitter_model.enable();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
nav.display_modal("Error", "Jamming bandwidth too large.");
|
jamming = true;
|
||||||
|
button_transmit.set_style(&style_cancel);
|
||||||
|
button_transmit.set_text("STOP");
|
||||||
|
|
||||||
|
transmitter_model.set_sampling_rate(1536000U);
|
||||||
|
transmitter_model.set_rf_amp(true);
|
||||||
|
transmitter_model.set_baseband_bandwidth(1750000);
|
||||||
|
transmitter_model.enable();
|
||||||
|
|
||||||
|
baseband::set_jammer();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
nav.display_modal("Error", "Jamming bandwidth too large.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
freq_range_t frequency_range[3];
|
freq_range_t frequency_range[3];
|
||||||
|
|
||||||
void update_text(uint8_t id, rf::Frequency f);
|
void update_text(uint8_t id, rf::Frequency f);
|
||||||
void on_retune(const rf::Frequency freq);
|
void on_retune(const rf::Frequency freq, const uint32_t range);
|
||||||
|
|
||||||
// TODO: TDD UMTS, voir doc Arcep
|
// TODO: TDD UMTS, voir doc Arcep
|
||||||
// TODO: BT: 2 400 et 2 483,5 MHz
|
// TODO: BT: 2 400 et 2 483,5 MHz
|
||||||
@ -100,8 +100,8 @@ private:
|
|||||||
{ false, 0, 0 }},
|
{ false, 0, 0 }},
|
||||||
|
|
||||||
// GPS L1 & L2
|
// GPS L1 & L2
|
||||||
{{ true, 1575420000 - 50000, 1575420000 + 50000}, // BW: 100kHz
|
{{ true, 1575420000 - 1000000, 1575420000 + 1000000}, // BW: 2MHz
|
||||||
{ true, 1227600000 - 50000, 1227600000 + 50000 }, // BW: 100kHz
|
{ true, 1227600000 - 1000000, 1227600000 + 1000000 }, // BW: 2MHz
|
||||||
{ false, 0, 0 }},
|
{ false, 0, 0 }},
|
||||||
|
|
||||||
// WLAN 2.4G CH1
|
// WLAN 2.4G CH1
|
||||||
@ -177,6 +177,11 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Text text_range_number {
|
||||||
|
{ 14 * 8, 1 * 16, 2 * 8, 16 },
|
||||||
|
"--"
|
||||||
|
};
|
||||||
|
|
||||||
Text text_sweep {
|
Text text_sweep {
|
||||||
{ 1 * 8, 2 * 16, 6 * 8, 16 },
|
{ 1 * 8, 2 * 16, 6 * 8, 16 },
|
||||||
"Sweep:"
|
"Sweep:"
|
||||||
@ -202,14 +207,13 @@ private:
|
|||||||
};
|
};
|
||||||
OptionsField options_hop {
|
OptionsField options_hop {
|
||||||
{ 12 * 8, 4 * 16 },
|
{ 12 * 8, 4 * 16 },
|
||||||
6,
|
5,
|
||||||
{
|
{
|
||||||
{ " 10s", 0 },
|
{ " 10ms", 1 },
|
||||||
{ " 5s", 1 },
|
{ "100ms", 10 },
|
||||||
{ " 1s", 2 },
|
{ " 1s", 100 },
|
||||||
{ " 0.1s", 3 },
|
{ " 5s", 500 },
|
||||||
{ " 10ms", 4 },
|
{ " 10s", 1000 }
|
||||||
{ " 1ms", 5 }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -263,7 +267,7 @@ private:
|
|||||||
"Range 3"
|
"Range 3"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::array<Button, 6> buttons_freq;
|
std::array<Button, 6> buttons_freq { };
|
||||||
|
|
||||||
Text text_info1 {
|
Text text_info1 {
|
||||||
{ 3 * 8, 8 * 16 - 4 + 2, 25 * 8, 16 },
|
{ 3 * 8, 8 * 16 - 4 + 2, 25 * 8, 16 },
|
||||||
@ -294,7 +298,7 @@ private:
|
|||||||
Message::ID::Retune,
|
Message::ID::Retune,
|
||||||
[this](Message* const p) {
|
[this](Message* const p) {
|
||||||
const auto message = static_cast<const RetuneMessage*>(p);
|
const auto message = static_cast<const RetuneMessage*>(p);
|
||||||
this->on_retune(message->freq);
|
this->on_retune(message->freq, message->range);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -27,27 +27,29 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define POLY_MASK_32 0xB4BCD35C
|
|
||||||
|
|
||||||
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
||||||
|
|
||||||
if (!configured) return;
|
if (!configured) return;
|
||||||
|
|
||||||
for (size_t i = 0; i<buffer.count; i++) {
|
for (size_t i = 0; i < buffer.count; i++) {
|
||||||
|
|
||||||
if (s >= 10000) { //shared_memory.jammer_ranges[ir].duration
|
if (!jammer_duration) {
|
||||||
s = 0;
|
// Find next enabled range
|
||||||
for (;;) {
|
for (ir = 0; ir < 9; ir++) {
|
||||||
ir++;
|
current_range++;
|
||||||
if (ir > 15) ir = 0;
|
if (current_range == 9) current_range = 0;
|
||||||
if (jammer_ranges[ir].enabled == true) break;
|
if (jammer_ranges[current_range].enabled)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
jammer_bw = jammer_ranges[ir].width / 2;
|
|
||||||
|
|
||||||
message.freq = jammer_ranges[ir].center;
|
jammer_duration = jammer_ranges[current_range].duration;
|
||||||
|
jammer_bw = jammer_ranges[current_range].width / 6; // TODO: Exact value
|
||||||
|
|
||||||
|
// Ask for retune
|
||||||
|
message.freq = jammer_ranges[current_range].center;
|
||||||
|
message.range = current_range;
|
||||||
shared_memory.application_queue.push(message);
|
shared_memory.application_queue.push(message);
|
||||||
} else {
|
} else {
|
||||||
s++;
|
jammer_duration--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ramp
|
// Ramp
|
||||||
@ -61,7 +63,7 @@ void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
r++;
|
r++;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Phase
|
// Phase noise
|
||||||
if (r >= 70) {
|
if (r >= 70) {
|
||||||
aphase += ((aphase>>4) ^ 0x4573) << 14;
|
aphase += ((aphase>>4) ^ 0x4573) << 14;
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -70,69 +72,32 @@ void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aphase += 8830;
|
aphase += 8830;
|
||||||
sample = sine_table_i8[(sphase & 0x03FC0000) >> 18];
|
sample = sine_table_i8[(aphase & 0x03FC0000) >> 18];
|
||||||
|
|
||||||
// FM
|
// FM
|
||||||
delta = sample * jammer_bw;
|
delta = sample * jammer_bw;
|
||||||
|
|
||||||
phase = (phase + delta);
|
phase += delta;
|
||||||
sphase = phase + (64 << 18);
|
sphase = phase + (64 << 18);
|
||||||
|
|
||||||
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
||||||
im = (sine_table_i8[(phase & 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};
|
||||||
|
//buffer.p[i] = {re, im};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void JammerProcessor::on_message(const Message* const msg) {
|
void JammerProcessor::on_message(const Message* const msg) {
|
||||||
|
const auto message = *reinterpret_cast<const JammerConfigureMessage*>(msg);
|
||||||
|
|
||||||
jammer_ranges = (JammerRange*)shared_memory.bb_data.data;
|
if (message.id == Message::ID::JammerConfigure) {
|
||||||
|
jammer_ranges = (JammerRange*)shared_memory.bb_data.data;
|
||||||
/*const auto message = *reinterpret_cast<const DTMFTXConfigMessage*>(msg);
|
jammer_duration = 0;
|
||||||
|
current_range = -1;
|
||||||
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;
|
configured = true;
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
@ -38,18 +38,17 @@ private:
|
|||||||
|
|
||||||
BasebandThread baseband_thread { 1536000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
BasebandThread baseband_thread { 1536000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||||
|
|
||||||
JammerRange * jammer_ranges;
|
JammerRange * jammer_ranges { };
|
||||||
|
|
||||||
int32_t lfsr32 = 0xABCDE;
|
uint32_t jammer_duration { 0 };
|
||||||
uint32_t s;
|
int8_t r { 0 }, ir { 0 };
|
||||||
int8_t r, ir, re, im;
|
int32_t current_range { 0 };
|
||||||
int64_t jammer_bw, jammer_center;
|
int64_t jammer_center { 0 };
|
||||||
int feedback;
|
uint32_t sample_count { 0 };
|
||||||
int32_t lfsr;
|
uint32_t aphase { 0 }, phase { 0 }, delta { 0 }, sphase { 0 };
|
||||||
uint32_t sample_count;
|
int32_t sample { 0 }, jammer_bw { 0 };
|
||||||
uint32_t aphase, phase, sphase;
|
int8_t re, im;
|
||||||
int32_t sample, delta;
|
RetuneMessage message { };
|
||||||
RetuneMessage message;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,12 +28,13 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
void OOKProcessor::execute(const buffer_c8_t& buffer) {
|
void OOKProcessor::execute(const buffer_c8_t& buffer) {
|
||||||
|
int8_t re, im;
|
||||||
|
|
||||||
// This is called at 2.28M/2048 = 1113Hz
|
// This is called at 2.28M/2048 = 1113Hz
|
||||||
|
|
||||||
if (!configured) return;
|
if (!configured) return;
|
||||||
|
|
||||||
for (size_t i = 0; i<buffer.count; i++) {
|
for (size_t i = 0; i < buffer.count; i++) {
|
||||||
|
|
||||||
// Synthesis at 2.28M/10 = 228kHz
|
// Synthesis at 2.28M/10 = 228kHz
|
||||||
if (!s) {
|
if (!s) {
|
||||||
@ -89,7 +90,7 @@ void OOKProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
im = 0;
|
im = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.p[i] = {(int8_t)re, (int8_t)im};
|
buffer.p[i] = {re, im};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,22 +37,21 @@ private:
|
|||||||
|
|
||||||
BasebandThread baseband_thread { 2280000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
BasebandThread baseband_thread { 2280000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||||
|
|
||||||
uint32_t samples_per_bit;
|
uint32_t samples_per_bit { 0 };
|
||||||
uint8_t repeat;
|
uint8_t repeat { 0 };
|
||||||
uint32_t length;
|
uint32_t length { 0 };
|
||||||
uint32_t pause;
|
uint32_t pause { 0 };
|
||||||
|
|
||||||
uint32_t pause_counter = 0;
|
uint32_t pause_counter { 0 };
|
||||||
uint8_t repeat_counter = 0;
|
uint8_t repeat_counter { 0 };
|
||||||
int8_t re, im;
|
uint8_t s { 0 };
|
||||||
uint8_t s = 0;
|
uint16_t bit_pos { 0 };
|
||||||
uint16_t bit_pos = 0;
|
uint8_t cur_bit { 0 };
|
||||||
uint8_t cur_bit = 0;
|
uint32_t sample_count { 0 };
|
||||||
uint32_t sample_count;
|
uint32_t tone_phase { 0 }, phase { 0 }, sphase { 0 };
|
||||||
uint32_t tone_phase, phase, sphase;
|
int32_t tone_sample { 0 }, sig { 0 }, frq { 0 };
|
||||||
int32_t tone_sample, sig, frq;
|
|
||||||
|
|
||||||
TXDoneMessage txdone_message;
|
TXDoneMessage txdone_message { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
TXDone = 30,
|
TXDone = 30,
|
||||||
Retune = 31,
|
Retune = 31,
|
||||||
|
|
||||||
TonesConfigure = 32,
|
TonesConfigure = 32,
|
||||||
AFSKConfigure = 33,
|
AFSKConfigure = 33,
|
||||||
PWMRSSIConfigure = 34,
|
PWMRSSIConfigure = 34,
|
||||||
@ -81,8 +82,9 @@ public:
|
|||||||
POCSAGConfigure = 38,
|
POCSAGConfigure = 38,
|
||||||
DTMFTXConfig = 39,
|
DTMFTXConfig = 39,
|
||||||
ADSBConfigure = 40,
|
ADSBConfigure = 40,
|
||||||
|
JammerConfigure = 41,
|
||||||
|
|
||||||
POCSAGPacket = 41,
|
POCSAGPacket = 50,
|
||||||
|
|
||||||
FIFOSignal = 52,
|
FIFOSignal = 52,
|
||||||
FIFOData = 53,
|
FIFOData = 53,
|
||||||
@ -605,6 +607,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t freq = 0;
|
int64_t freq = 0;
|
||||||
|
uint32_t range = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioTXConfigMessage : public Message {
|
class AudioTXConfigMessage : public Message {
|
||||||
@ -700,6 +703,18 @@ public:
|
|||||||
const uint32_t test;
|
const uint32_t test;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class JammerConfigureMessage : public Message {
|
||||||
|
public:
|
||||||
|
constexpr JammerConfigureMessage(
|
||||||
|
const uint32_t test
|
||||||
|
) : Message { ID::JammerConfigure },
|
||||||
|
test(test)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint32_t test;
|
||||||
|
};
|
||||||
|
|
||||||
class DTMFTXConfigMessage : public Message {
|
class DTMFTXConfigMessage : public Message {
|
||||||
public:
|
public:
|
||||||
constexpr DTMFTXConfigMessage(
|
constexpr DTMFTXConfigMessage(
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user