mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-02-28 20:27:20 +00:00
Started work on ADS-B TX baseband processor
This commit is contained in:
parent
596071e8f8
commit
ef0feae62b
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -143,6 +144,13 @@ void set_pocsag() {
|
|||||||
send_message(&message);
|
send_message(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_adsb() {
|
||||||
|
const ADSBConfigureMessage message {
|
||||||
|
1
|
||||||
|
};
|
||||||
|
send_message(&message);
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
const DTMFTXConfigMessage message {
|
const DTMFTXConfigMessage message {
|
||||||
bw,
|
bw,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -61,6 +62,7 @@ void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phas
|
|||||||
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
|
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
|
||||||
const uint32_t pause_symbols);
|
const uint32_t pause_symbols);
|
||||||
void set_pocsag();
|
void set_pocsag();
|
||||||
|
void set_adsb();
|
||||||
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);
|
||||||
|
|
||||||
void run_image(const portapack::spi_flash::image_tag_t image_tag);
|
void run_image(const portapack::spi_flash::image_tag_t image_tag);
|
||||||
|
@ -48,13 +48,92 @@ void ADSBTxView::paint(Painter& painter) {
|
|||||||
button_callsign.set_text(callsign);
|
button_callsign.set_text(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADSBTxView::generate_frame() {
|
void ADSBTxView::generate_frame_pos() {
|
||||||
|
uint8_t b, c, s, time_parity, bitn;
|
||||||
|
char ch;
|
||||||
|
std::string str_debug;
|
||||||
|
uint16_t altitude_coded = (38000 + 1000) / 25;
|
||||||
|
uint32_t LAT, LON;
|
||||||
|
float delta_lat, yz, rlat, delta_lon, xz;
|
||||||
|
uint8_t adsb_crc[14]; // Temp buffer
|
||||||
|
uint32_t crc_poly = 0x1205FFF;
|
||||||
|
|
||||||
|
LAT = 0;
|
||||||
|
|
||||||
|
adsb_frame[0] = (options_format.selected_index_value() << 3) | 5; // DF and CA
|
||||||
|
adsb_frame[1] = 0x48; // ICAO24
|
||||||
|
adsb_frame[2] = 0x40;
|
||||||
|
adsb_frame[3] = 0xD6;
|
||||||
|
adsb_frame[4] = 0x58; // TC, SS and NICsb
|
||||||
|
|
||||||
|
// altitude = (feet + 1000) / 25
|
||||||
|
|
||||||
|
// LAT:
|
||||||
|
// index j = floor(59*latcprE-60*latcprO+0.50)
|
||||||
|
// latE = DlatE*(mod(j,60)+latcprE)
|
||||||
|
// latO = DlatO*(mod(j,59)+latcprO)
|
||||||
|
// if latE >= 270 -> latE -= 360
|
||||||
|
// if latO >= 270 -> latO -= 360
|
||||||
|
//time_parity = 0; // 0~1
|
||||||
|
//delta_lat = 90.0 / (60.0 - (time_parity / 4.0));
|
||||||
|
//yz = 524288.0 * (mod(lat, delta_lat) / delta_lat); // Round to int !
|
||||||
|
//rlat = delta_lat * ((yz / 524288.0) + int(lat / delta_lat));
|
||||||
|
//delta_lon = 360.0 / (NL(rlat) - time_parity);
|
||||||
|
//xz = 524288.0 * (mod(lon, delta_lon) / delta_lon); // Round to int !
|
||||||
|
/*if (time_parity) {
|
||||||
|
A = sign(rlat0)[NL(rlat0) - NL(rlat1)];
|
||||||
|
}*/
|
||||||
|
// int xz and yz, then:
|
||||||
|
// xz >>= 2;
|
||||||
|
// yz >>= 2;
|
||||||
|
// To get 17 bits
|
||||||
|
|
||||||
|
// aaaaaaa Q bbbb
|
||||||
|
adsb_frame[5] = ((altitude_coded & 0x7F0) >> 3) | 1;
|
||||||
|
adsb_frame[6] = ((altitude_coded & 0x00F) << 4) | (LAT >> 15); // Then 0, even/odd, and the 2 LAT-CPR MSBs
|
||||||
|
|
||||||
|
adsb_frame[11] = 0x00; // Clear CRC
|
||||||
|
adsb_frame[12] = 0x00;
|
||||||
|
adsb_frame[13] = 0x00;
|
||||||
|
|
||||||
|
// Compute CRC
|
||||||
|
memcpy(adsb_crc, adsb_frame, 14);
|
||||||
|
for (c = 0; c < 11; c++) {
|
||||||
|
for (b = 0; b < 8; b++) {
|
||||||
|
if ((adsb_crc[c] << b) & 0x80) {
|
||||||
|
for (s = 0; s < 25; s++) {
|
||||||
|
bitn = (c * 8) + b + s;
|
||||||
|
if ((crc_poly >> s) & 1) adsb_crc[bitn >> 3] ^= (0x80 >> (bitn & 7));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Insert CRC in frame
|
||||||
|
for (c = 0; c < 3; c++)
|
||||||
|
adsb_frame[c + 11] = adsb_crc[c + 11];
|
||||||
|
|
||||||
|
// Convert to binary
|
||||||
|
for (c = 0; c < 112; c++)
|
||||||
|
adsb_bin[c] = (adsb_frame[c >> 3] >> (7 - (c & 7))) & 1;
|
||||||
|
|
||||||
|
// Display for debug
|
||||||
|
str_debug = "";
|
||||||
|
for (c = 0; c < 7; c++)
|
||||||
|
str_debug += to_string_hex(adsb_frame[c], 2);
|
||||||
|
text_frame_a.set(str_debug);
|
||||||
|
str_debug = "";
|
||||||
|
for (c = 0; c < 7; c++)
|
||||||
|
str_debug += to_string_hex(adsb_frame[c + 7], 2);
|
||||||
|
text_frame_b.set(str_debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADSBTxView::generate_frame_id() {
|
||||||
uint8_t b, c, s, bitn;
|
uint8_t b, c, s, bitn;
|
||||||
char ch;
|
char ch;
|
||||||
|
std::string str_debug;
|
||||||
std::string callsign_formatted(8, '_');
|
std::string callsign_formatted(8, '_');
|
||||||
uint64_t callsign_coded = 0;
|
uint64_t callsign_coded = 0;
|
||||||
uint8_t adsb_crc[14]; // Temp buffer
|
uint8_t adsb_crc[14]; // Temp buffer
|
||||||
// 1 00100000 01011111 11111111
|
|
||||||
uint32_t crc_poly = 0x1205FFF;
|
uint32_t crc_poly = 0x1205FFF;
|
||||||
|
|
||||||
// Init frame
|
// Init frame
|
||||||
@ -91,7 +170,7 @@ void ADSBTxView::generate_frame() {
|
|||||||
adsb_frame[c + 5] = (callsign_coded >> ((5 - c) * 8)) & 0xFF;
|
adsb_frame[c + 5] = (callsign_coded >> ((5 - c) * 8)) & 0xFF;
|
||||||
|
|
||||||
// Compute CRC
|
// Compute CRC
|
||||||
memcpy(adsb_crc, adsb_frames, 14);
|
memcpy(adsb_crc, adsb_frame, 14);
|
||||||
for (c = 0; c < 11; c++) {
|
for (c = 0; c < 11; c++) {
|
||||||
for (b = 0; b < 8; b++) {
|
for (b = 0; b < 8; b++) {
|
||||||
if ((adsb_crc[c] << b) & 0x80) {
|
if ((adsb_crc[c] << b) & 0x80) {
|
||||||
@ -106,18 +185,28 @@ void ADSBTxView::generate_frame() {
|
|||||||
for (c = 0; c < 3; c++)
|
for (c = 0; c < 3; c++)
|
||||||
adsb_frame[c + 11] = adsb_crc[c + 11];
|
adsb_frame[c + 11] = adsb_crc[c + 11];
|
||||||
|
|
||||||
// Display as text
|
// Convert to binary
|
||||||
text_message.set(to_string_hex((adsb_frame[11] << 16) + (adsb_frame[12] << 8) + adsb_frame[13], 6));
|
for (c = 0; c < 112; c++)
|
||||||
//text_message.set(callsign_formatted);
|
adsb_bin[c] = (adsb_frame[c >> 3] >> (7 - (c & 7))) & 1;
|
||||||
|
|
||||||
//ascii_to_ccir(ccir_message);
|
// Display for debug
|
||||||
|
str_debug = "";
|
||||||
|
for (c = 0; c < 7; c++)
|
||||||
|
str_debug += to_string_hex(adsb_frame[c], 2);
|
||||||
|
text_frame_a.set(str_debug);
|
||||||
|
str_debug = "";
|
||||||
|
for (c = 0; c < 7; c++)
|
||||||
|
str_debug += to_string_hex(adsb_frame[c + 7], 2);
|
||||||
|
text_frame_b.set(str_debug);
|
||||||
|
|
||||||
|
text_message.set(callsign_formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADSBTxView::start_tx() {
|
void ADSBTxView::start_tx() {
|
||||||
transmitter_model.set_tuning_frequency(450000000); // FOR TESTING - DEBUG
|
transmitter_model.set_tuning_frequency(452000000); // FOR TESTING - DEBUG
|
||||||
transmitter_model.set_baseband_configuration({
|
transmitter_model.set_baseband_configuration({
|
||||||
.mode = 0,
|
.mode = 0,
|
||||||
.sampling_rate = 1536000U, // CHANGE !
|
.sampling_rate = 2000000U, // Good ?
|
||||||
.decimation_factor = 1,
|
.decimation_factor = 1,
|
||||||
});
|
});
|
||||||
transmitter_model.set_rf_amp(true);
|
transmitter_model.set_rf_amp(true);
|
||||||
@ -126,23 +215,8 @@ void ADSBTxView::start_tx() {
|
|||||||
transmitter_model.set_baseband_bandwidth(1750000);
|
transmitter_model.set_baseband_bandwidth(1750000);
|
||||||
transmitter_model.enable();
|
transmitter_model.enable();
|
||||||
|
|
||||||
//memcpy(shared_memory.tx_data, adsb_frame, 112);
|
memcpy(shared_memory.tx_data, adsb_bin, 112);
|
||||||
//baseband::set_adsb_data(1);
|
baseband::set_adsb();
|
||||||
}
|
|
||||||
|
|
||||||
// ASCII to frequency LUT index
|
|
||||||
void ADSBTxView::ascii_to_ccir(char *ascii) {
|
|
||||||
uint8_t c;
|
|
||||||
|
|
||||||
for (c = 0; c < 20; c++) {
|
|
||||||
if (ascii[c] > '9')
|
|
||||||
ascii[c] -= 0x37;
|
|
||||||
else
|
|
||||||
ascii[c] -= 0x30;
|
|
||||||
}
|
|
||||||
|
|
||||||
// EOM code for baseband
|
|
||||||
ascii[20] = 0xFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADSBTxView::on_txdone(const int n) {
|
void ADSBTxView::on_txdone(const int n) {
|
||||||
@ -163,7 +237,9 @@ void ADSBTxView::on_txdone(const int n) {
|
|||||||
ADSBTxView::ADSBTxView(NavigationView& nav) {
|
ADSBTxView::ADSBTxView(NavigationView& nav) {
|
||||||
(void)nav;
|
(void)nav;
|
||||||
|
|
||||||
baseband::run_image(portapack::spi_flash::image_tag_xylos);
|
baseband::run_image(portapack::spi_flash::image_tag_adsb_tx);
|
||||||
|
|
||||||
|
// http://openflights.org
|
||||||
|
|
||||||
add_children({ {
|
add_children({ {
|
||||||
&text_format,
|
&text_format,
|
||||||
@ -172,6 +248,8 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
|||||||
&button_icao,
|
&button_icao,
|
||||||
&text_callsign,
|
&text_callsign,
|
||||||
&button_callsign,
|
&button_callsign,
|
||||||
|
&text_frame_a,
|
||||||
|
&text_frame_b,
|
||||||
&progress,
|
&progress,
|
||||||
&text_message,
|
&text_message,
|
||||||
&button_transmit
|
&button_transmit
|
||||||
@ -184,7 +262,7 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
|||||||
options_format.on_change = [this](size_t i, int32_t v) {
|
options_format.on_change = [this](size_t i, int32_t v) {
|
||||||
(void)i;
|
(void)i;
|
||||||
(void)v;
|
(void)v;
|
||||||
generate_frame();
|
generate_frame_id();
|
||||||
};
|
};
|
||||||
button_callsign.on_select = [this, &nav](Button&) {
|
button_callsign.on_select = [this, &nav](Button&) {
|
||||||
textentry(nav, callsign, 9);
|
textentry(nav, callsign, 9);
|
||||||
@ -192,15 +270,15 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
|||||||
|
|
||||||
button_transmit.set_style(&style_val);
|
button_transmit.set_style(&style_val);
|
||||||
|
|
||||||
generate_frame();
|
generate_frame_id();
|
||||||
|
|
||||||
// Single transmit
|
// Single transmit
|
||||||
button_transmit.on_select = [this,&nav](Button&) {
|
button_transmit.on_select = [this, &nav](Button&) {
|
||||||
if (tx_mode == IDLE) {
|
if (tx_mode == IDLE) {
|
||||||
tx_mode = SINGLE;
|
tx_mode = SINGLE;
|
||||||
button_transmit.set_style(&style_cancel);
|
button_transmit.set_style(&style_cancel);
|
||||||
button_transmit.set_text("Wait");
|
button_transmit.set_text("Wait");
|
||||||
generate_frame();
|
generate_frame_id();
|
||||||
start_tx();
|
start_tx();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -55,12 +55,13 @@ private:
|
|||||||
char callsign[9] = "KLM1023 ";
|
char callsign[9] = "KLM1023 ";
|
||||||
|
|
||||||
uint8_t adsb_frame[14]; // 112 bit data block as 14 bytes
|
uint8_t adsb_frame[14]; // 112 bit data block as 14 bytes
|
||||||
|
uint8_t adsb_bin[112]; // 112 bit data block
|
||||||
|
|
||||||
const char icao_id_lut[65] = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ##### ###############0123456789######";
|
const char icao_id_lut[65] = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ##### ###############0123456789######";
|
||||||
|
|
||||||
void ascii_to_ccir(char *ascii);
|
|
||||||
void start_tx();
|
void start_tx();
|
||||||
void generate_frame();
|
void generate_frame_id();
|
||||||
|
void generate_frame_pos();
|
||||||
void on_txdone(const int n);
|
void on_txdone(const int n);
|
||||||
|
|
||||||
const Style style_val {
|
const Style style_val {
|
||||||
@ -111,6 +112,15 @@ private:
|
|||||||
"" // "KOR151 "
|
"" // "KOR151 "
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Text text_frame_a {
|
||||||
|
{ 4 * 8, 10 * 16, 14 * 8, 16 },
|
||||||
|
"-"
|
||||||
|
};
|
||||||
|
Text text_frame_b {
|
||||||
|
{ 4 * 8, 11 * 16, 14 * 8, 16 },
|
||||||
|
"-"
|
||||||
|
};
|
||||||
|
|
||||||
ProgressBar progress {
|
ProgressBar progress {
|
||||||
{ 5 * 8, 13 * 16, 20 * 8, 16 },
|
{ 5 * 8, 13 * 16, 20 * 8, 16 },
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -22,17 +23,11 @@
|
|||||||
#include "ui_jammer.hpp"
|
#include "ui_jammer.hpp"
|
||||||
#include "ui_receiver.hpp"
|
#include "ui_receiver.hpp"
|
||||||
|
|
||||||
#include "ch.h"
|
//#include "ch.h"
|
||||||
#include "evtimer.h"
|
//#include "evtimer.h"
|
||||||
#include "baseband_api.hpp"
|
#include "baseband_api.hpp"
|
||||||
#include "ff.h"
|
|
||||||
#include "hackrf_gpio.hpp"
|
|
||||||
#include "portapack.hpp"
|
|
||||||
#include "radio.hpp"
|
|
||||||
#include "string_format.hpp"
|
#include "string_format.hpp"
|
||||||
#include "event_m0.hpp"
|
|
||||||
|
|
||||||
#include "hackrf_hal.hpp"
|
|
||||||
#include "portapack_shared_memory.hpp"
|
#include "portapack_shared_memory.hpp"
|
||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
|
|
||||||
@ -48,7 +43,7 @@ void JammerView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JammerView::~JammerView() {
|
JammerView::~JammerView() {
|
||||||
radio::disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,24 +316,26 @@ JammerView::JammerView(NavigationView& nav) {
|
|||||||
jamming = true;
|
jamming = true;
|
||||||
button_transmit.set_style(&style_cancel);
|
button_transmit.set_style(&style_cancel);
|
||||||
button_transmit.set_text("STOP");
|
button_transmit.set_text("STOP");
|
||||||
radio::disable();
|
|
||||||
|
/*baseband::set_jammer_data(
|
||||||
|
|
||||||
|
);*/
|
||||||
|
|
||||||
|
//transmitter_model.set_tuning_frequency(433920000); // TODO
|
||||||
|
transmitter_model.set_baseband_configuration({
|
||||||
|
.mode = 0,
|
||||||
|
.sampling_rate = 1536000U,
|
||||||
|
.decimation_factor = 1,
|
||||||
|
});
|
||||||
|
transmitter_model.set_rf_amp(true);
|
||||||
|
transmitter_model.set_baseband_bandwidth(1750000);
|
||||||
|
transmitter_model.enable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
button_exit.on_select = [&nav](Button&){
|
button_exit.on_select = [&nav](Button&){
|
||||||
nav.pop();
|
nav.pop();
|
||||||
};
|
};
|
||||||
|
|
||||||
radio::enable({
|
|
||||||
shared_memory.jammer_ranges[0].center,
|
|
||||||
1536000, // ?
|
|
||||||
2500000, // ?
|
|
||||||
rf::Direction::Transmit,
|
|
||||||
true,
|
|
||||||
static_cast<int8_t>(receiver_model.lna()),
|
|
||||||
static_cast<int8_t>(receiver_model.vga()),
|
|
||||||
1,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -21,15 +22,10 @@
|
|||||||
|
|
||||||
#include "ui.hpp"
|
#include "ui.hpp"
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
#include "ui_painter.hpp"
|
|
||||||
#include "ui_menu.hpp"
|
|
||||||
#include "ui_navigation.hpp"
|
|
||||||
#include "ui_font_fixed_8x16.hpp"
|
#include "ui_font_fixed_8x16.hpp"
|
||||||
#include "clock_manager.hpp"
|
#include "ui_navigation.hpp"
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "rf_path.hpp"
|
#include "transmitter_model.hpp"
|
||||||
#include "max2837.hpp"
|
|
||||||
#include "volume.hpp"
|
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -66,7 +62,7 @@ private:
|
|||||||
rf::Frequency max;
|
rf::Frequency max;
|
||||||
} rangepreset;
|
} rangepreset;
|
||||||
|
|
||||||
const rangepreset range_presets[9][3] = {
|
const rangepreset range_presets[10][3] = {
|
||||||
// Orange
|
// Orange
|
||||||
{{ true, 935000000, 945000000 }, // GSM 900
|
{{ true, 935000000, 945000000 }, // GSM 900
|
||||||
{ true, 1808000000, 1832000000 }, // GSM 1800
|
{ true, 1808000000, 1832000000 }, // GSM 1800
|
||||||
@ -93,14 +89,14 @@ private:
|
|||||||
{ false, 0, 0 }}, // UMTS
|
{ false, 0, 0 }}, // UMTS
|
||||||
|
|
||||||
// TODO: TDD UMTS, voir doc Arcep
|
// TODO: TDD UMTS, voir doc Arcep
|
||||||
// TODO: Wi-FI, BT: 2 400 et 2 483,5 MHz
|
// TODO: Wifi, BT: 2 400 et 2 483,5 MHz
|
||||||
|
|
||||||
// DECT
|
// DECT
|
||||||
{{ true, 1880000000, 1900000000 }, // BW: 20MHz
|
{{ true, 1880000000, 1900000000 }, // BW: 20MHz
|
||||||
{ false, 0, 0 },
|
{ false, 0, 0 },
|
||||||
{ false, 0, 0 }},
|
{ false, 0, 0 }},
|
||||||
|
|
||||||
// Optifib, lol
|
// PMV AFSK
|
||||||
{{ true, 162930000, 162970000 }, // BW: 40kHz
|
{{ true, 162930000, 162970000 }, // BW: 40kHz
|
||||||
{ false, 0, 0 },
|
{ false, 0, 0 },
|
||||||
{ false, 0, 0 }},
|
{ false, 0, 0 }},
|
||||||
@ -110,6 +106,11 @@ private:
|
|||||||
{ false, 0, 0 },
|
{ false, 0, 0 },
|
||||||
{ false, 0, 0 }},
|
{ false, 0, 0 }},
|
||||||
|
|
||||||
|
// Sigfox
|
||||||
|
{{ true, 868150000, 868250000 }, // BW: 40kHz (50kHz)
|
||||||
|
{ false, 0, 0 },
|
||||||
|
{ false, 0, 0 }},
|
||||||
|
|
||||||
// GPS L1 & L2
|
// GPS L1 & L2
|
||||||
{{ true, 1575420000 - 50000, 1575420000 + 50000}, // BW: 100kHz
|
{{ true, 1575420000 - 50000, 1575420000 + 50000}, // BW: 100kHz
|
||||||
{ true, 1227600000 - 50000, 1227600000 + 50000 }, // BW: 100kHz
|
{ true, 1227600000 - 50000, 1227600000 + 50000 }, // BW: 100kHz
|
||||||
@ -177,7 +178,7 @@ private:
|
|||||||
};
|
};
|
||||||
OptionsField options_preset {
|
OptionsField options_preset {
|
||||||
{ 10 * 8, 3 * 16 },
|
{ 10 * 8, 3 * 16 },
|
||||||
9,
|
8,
|
||||||
{
|
{
|
||||||
{ "Orange ", 0 },
|
{ "Orange ", 0 },
|
||||||
{ "SFR ", 1 },
|
{ "SFR ", 1 },
|
||||||
@ -187,7 +188,8 @@ private:
|
|||||||
{ "DECT ", 5 },
|
{ "DECT ", 5 },
|
||||||
{ "Optifib ", 6 },
|
{ "Optifib ", 6 },
|
||||||
{ "ISM 433 ", 7 },
|
{ "ISM 433 ", 7 },
|
||||||
{ "GPS ", 8 },
|
{ "Sigfox ", 8 },
|
||||||
|
{ "GPS ", 9 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ private:
|
|||||||
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
@ -342,10 +342,10 @@ DeclareTargets(POOK ook)
|
|||||||
|
|
||||||
### Jammer
|
### Jammer
|
||||||
|
|
||||||
#set(MODE_CPPSRC
|
set(MODE_CPPSRC
|
||||||
# proc_jammer.cpp
|
proc_jammer.cpp
|
||||||
#)
|
)
|
||||||
#DeclareTargets(PJAM jammer)
|
DeclareTargets(PJAM jammer)
|
||||||
|
|
||||||
### Audio transmit
|
### Audio transmit
|
||||||
|
|
||||||
@ -389,6 +389,13 @@ set(MODE_CPPSRC
|
|||||||
)
|
)
|
||||||
DeclareTargets(PRDS rds)
|
DeclareTargets(PRDS rds)
|
||||||
|
|
||||||
|
### ADS-B TX
|
||||||
|
|
||||||
|
set(MODE_CPPSRC
|
||||||
|
proc_adsbtx.cpp
|
||||||
|
)
|
||||||
|
DeclareTargets(PADS ads)
|
||||||
|
|
||||||
### HackRF "factory" firmware
|
### HackRF "factory" firmware
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
BIN
firmware/baseband/baseband_ads.img
Normal file
BIN
firmware/baseband/baseband_ads.img
Normal file
Binary file not shown.
103
firmware/baseband/proc_adsbtx.cpp
Normal file
103
firmware/baseband/proc_adsbtx.cpp
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
|
*
|
||||||
|
* 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_adsbtx.hpp"
|
||||||
|
#include "portapack_shared_memory.hpp"
|
||||||
|
#include "sine_table_int8.hpp"
|
||||||
|
#include "event_m4.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
void ADSBTXProcessor::execute(const buffer_c8_t& buffer) {
|
||||||
|
|
||||||
|
// This is called at 2M/2048 = 977Hz
|
||||||
|
|
||||||
|
if (!configured) return;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < buffer.count; i++) {
|
||||||
|
|
||||||
|
// Synthesis at 2M
|
||||||
|
/*if (preamble == true) {
|
||||||
|
if (bit_pos >= 16) {
|
||||||
|
bit_pos = 0;
|
||||||
|
preamble = false;
|
||||||
|
bit_part = 0;
|
||||||
|
} else {
|
||||||
|
cur_bit = (preamble_parts << bit_pos) >> 15;
|
||||||
|
bit_pos++;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
//if (preamble == false) {
|
||||||
|
if (!bit_part) {
|
||||||
|
if (bit_pos >= 112) {
|
||||||
|
// Stop
|
||||||
|
cur_bit = 0;
|
||||||
|
} else {
|
||||||
|
cur_bit = shared_memory.tx_data[bit_pos];
|
||||||
|
bit_pos++;
|
||||||
|
bit_part = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bit_part = 0;
|
||||||
|
cur_bit ^= 1;
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
// 8D48: 10001101 01001000
|
||||||
|
// 1001010110100110 0110010110010101
|
||||||
|
|
||||||
|
if (cur_bit) {
|
||||||
|
phase = (phase + 0x1FE0000); // What ?
|
||||||
|
sphase = phase + (64 << 18);
|
||||||
|
|
||||||
|
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
||||||
|
im = (sine_table_i8[(phase & 0x03FC0000) >> 18]);
|
||||||
|
} else {
|
||||||
|
re = 0;
|
||||||
|
im = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.p[i] = {(int8_t)re, (int8_t)im};
|
||||||
|
}
|
||||||
|
|
||||||
|
// TEST
|
||||||
|
message.n = 200;
|
||||||
|
shared_memory.application_queue.push(message);
|
||||||
|
configured = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADSBTXProcessor::on_message(const Message* const p) {
|
||||||
|
const auto message = *reinterpret_cast<const ADSBConfigureMessage*>(p);
|
||||||
|
|
||||||
|
if (message.id == Message::ID::ADSBConfigure) {
|
||||||
|
bit_pos = 0;
|
||||||
|
cur_bit = 0;
|
||||||
|
preamble = true;
|
||||||
|
configured = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
EventDispatcher event_dispatcher { std::make_unique<ADSBTXProcessor>() };
|
||||||
|
event_dispatcher.run();
|
||||||
|
return 0;
|
||||||
|
}
|
52
firmware/baseband/proc_adsbtx.hpp
Normal file
52
firmware/baseband/proc_adsbtx.hpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
|
*
|
||||||
|
* 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_ADSBTX_H__
|
||||||
|
#define __PROC_ADSBTX_H__
|
||||||
|
|
||||||
|
#include "baseband_processor.hpp"
|
||||||
|
#include "baseband_thread.hpp"
|
||||||
|
|
||||||
|
class ADSBTXProcessor : public BasebandProcessor {
|
||||||
|
public:
|
||||||
|
void execute(const buffer_c8_t& buffer) override;
|
||||||
|
|
||||||
|
void on_message(const Message* const p) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool configured = false;
|
||||||
|
|
||||||
|
BasebandThread baseband_thread { 2000000, this, NORMALPRIO + 20, baseband::Direction::Transmit }; // 2280000
|
||||||
|
|
||||||
|
const uint16_t preamble_parts = 0b1010000101000000;
|
||||||
|
uint8_t bit_part;
|
||||||
|
bool preamble;
|
||||||
|
int8_t re, im;
|
||||||
|
uint16_t bit_pos = 0;
|
||||||
|
uint8_t cur_bit = 0;
|
||||||
|
uint32_t phase, sphase;
|
||||||
|
int32_t sig, frq;
|
||||||
|
|
||||||
|
TXDoneMessage message;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -21,7 +22,7 @@
|
|||||||
|
|
||||||
#include "proc_jammer.hpp"
|
#include "proc_jammer.hpp"
|
||||||
#include "portapack_shared_memory.hpp"
|
#include "portapack_shared_memory.hpp"
|
||||||
#include "sine_table.hpp"
|
#include "sine_table_int8.hpp"
|
||||||
#include "event_m4.hpp"
|
#include "event_m4.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -29,6 +30,9 @@
|
|||||||
#define POLY_MASK_32 0xB4BCD35C
|
#define POLY_MASK_32 0xB4BCD35C
|
||||||
|
|
||||||
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
||||||
|
|
||||||
|
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 (s >= 10000) { //shared_memory.jammer_ranges[ir].duration
|
||||||
@ -66,21 +70,68 @@ void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aphase += 8830;
|
aphase += 8830;
|
||||||
sample = sine_table_f32[(aphase & 0x03FF0000)>>18]*256;
|
sample = sine_table_i8[(sphase & 0x03FC0000) >> 18];
|
||||||
|
|
||||||
//FM
|
// FM
|
||||||
frq = sample * jammer_bw; // Bandwidth
|
frq = sample * jammer_bw;
|
||||||
|
|
||||||
phase = (phase + frq);
|
phase = (phase + frq);
|
||||||
sphase = phase + (256<<16);
|
sphase = phase + (64 << 18);
|
||||||
|
|
||||||
re = sine_table_f32[(sphase & 0x03FF0000)>>18]*127;
|
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
||||||
im = sine_table_f32[(phase & 0x03FF0000)>>18]*127;
|
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() {
|
int main() {
|
||||||
EventDispatcher event_dispatcher { std::make_unique<JammerProcessor>() };
|
EventDispatcher event_dispatcher { std::make_unique<JammerProcessor>() };
|
||||||
event_dispatcher.run();
|
event_dispatcher.run();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
@ -28,8 +29,14 @@
|
|||||||
class JammerProcessor : public BasebandProcessor {
|
class JammerProcessor : public BasebandProcessor {
|
||||||
public:
|
public:
|
||||||
void execute(const buffer_c8_t& buffer) override;
|
void execute(const buffer_c8_t& buffer) override;
|
||||||
|
|
||||||
|
void on_message(const Message* const msg) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool configured = false;
|
||||||
|
|
||||||
|
BasebandThread baseband_thread { 1536000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||||
|
|
||||||
int32_t lfsr32 = 0xABCDE;
|
int32_t lfsr32 = 0xABCDE;
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
int8_t r, ir, re, im;
|
int8_t r, ir, re, im;
|
||||||
|
@ -76,11 +76,12 @@ public:
|
|||||||
AudioTXConfig = 27,
|
AudioTXConfig = 27,
|
||||||
POCSAGConfigure = 28,
|
POCSAGConfigure = 28,
|
||||||
DTMFTXConfig = 29,
|
DTMFTXConfig = 29,
|
||||||
|
ADSBConfigure = 30,
|
||||||
|
|
||||||
POCSAGPacket = 30,
|
POCSAGPacket = 31,
|
||||||
|
|
||||||
FIFOSignal = 31,
|
FIFOSignal = 32,
|
||||||
FIFOData = 32,
|
FIFOData = 33,
|
||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -638,6 +639,18 @@ public:
|
|||||||
const uint32_t rate;
|
const uint32_t rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ADSBConfigureMessage : public Message {
|
||||||
|
public:
|
||||||
|
constexpr ADSBConfigureMessage(
|
||||||
|
const uint32_t test
|
||||||
|
) : Message { ID::ADSBConfigure },
|
||||||
|
test(test)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint32_t test;
|
||||||
|
};
|
||||||
|
|
||||||
class DTMFTXConfigMessage : public Message {
|
class DTMFTXConfigMessage : public Message {
|
||||||
public:
|
public:
|
||||||
constexpr DTMFTXConfigMessage(
|
constexpr DTMFTXConfigMessage(
|
||||||
|
@ -80,6 +80,7 @@ constexpr image_tag_t image_tag_xylos { 'P', 'X', 'Y', 'L' };
|
|||||||
constexpr image_tag_t image_tag_rds { 'P', 'R', 'D', 'S' };
|
constexpr image_tag_t image_tag_rds { 'P', 'R', 'D', 'S' };
|
||||||
constexpr image_tag_t image_tag_ook { 'P', 'O', 'O', 'K' };
|
constexpr image_tag_t image_tag_ook { 'P', 'O', 'O', 'K' };
|
||||||
constexpr image_tag_t image_tag_dtmf_tx { 'P', 'D', 'T', 'X' };
|
constexpr image_tag_t image_tag_dtmf_tx { 'P', 'D', 'T', 'X' };
|
||||||
|
constexpr image_tag_t image_tag_adsb_tx { 'P', 'A', 'D', 'S' };
|
||||||
|
|
||||||
constexpr image_tag_t image_tag_hackrf { 'H', 'R', 'F', '1' };
|
constexpr image_tag_t image_tag_hackrf { 'H', 'R', 'F', '1' };
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user