mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-12 01:29:29 +00:00
Added frequency manager skeleton, LCR alt encoding, GPS jammer
This commit is contained in:
@@ -138,6 +138,7 @@ CPPSRC = main.cpp \
|
||||
dsp_decimate.cpp \
|
||||
dsp_demodulate.cpp \
|
||||
matched_filter.cpp \
|
||||
proc_jammer.cpp \
|
||||
proc_audiotx.cpp \
|
||||
proc_fsk_lcr.cpp \
|
||||
proc_epar.cpp \
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "proc_epar.hpp"
|
||||
#include "proc_fsk_lcr.hpp"
|
||||
#include "proc_rds.hpp"
|
||||
#include "proc_jammer.hpp"
|
||||
|
||||
#include "rssi.hpp"
|
||||
#include "i2s.hpp"
|
||||
@@ -128,6 +129,7 @@ BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
|
||||
case 3: return new LCRFSKProcessor();
|
||||
case 4: return new EPARProcessor();
|
||||
case 5: return new RDSProcessor();
|
||||
case 6: return new JammerProcessor();
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,17 @@ void LCRFSKProcessor::execute(const buffer_c8_t& buffer) {
|
||||
s = 0;
|
||||
|
||||
if (sample_count >= shared_memory.afsk_samples_per_bit) {
|
||||
if (shared_memory.afsk_transmit_done == false)
|
||||
if (shared_memory.afsk_transmit_done == false) {
|
||||
cur_byte = shared_memory.radio_data[byte_pos];
|
||||
ext_byte = shared_memory.radio_data[byte_pos + 1];
|
||||
}
|
||||
if (!cur_byte) {
|
||||
if (shared_memory.afsk_repeat) {
|
||||
shared_memory.afsk_repeat--;
|
||||
bit_pos = 0;
|
||||
byte_pos = 0;
|
||||
cur_byte = shared_memory.radio_data[0];
|
||||
ext_byte = shared_memory.radio_data[1];
|
||||
message.n = shared_memory.afsk_repeat;
|
||||
shared_memory.application_queue.push(message);
|
||||
} else {
|
||||
@@ -49,18 +52,32 @@ void LCRFSKProcessor::execute(const buffer_c8_t& buffer) {
|
||||
shared_memory.afsk_transmit_done = true;
|
||||
shared_memory.application_queue.push(message);
|
||||
cur_byte = 0;
|
||||
ext_byte = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gbyte = 0;
|
||||
gbyte = cur_byte << 1;
|
||||
gbyte |= 1;
|
||||
if (shared_memory.afsk_alt_format) {
|
||||
// 0bbbbbbbbp
|
||||
// Start, 8-bit data, parity
|
||||
gbyte = 0;
|
||||
gbyte = cur_byte << 1;
|
||||
gbyte |= (ext_byte & 1);
|
||||
} else {
|
||||
// 0bbbbbbbp1
|
||||
// Start, 7-bit data, parity, stop
|
||||
gbyte = 0;
|
||||
gbyte = cur_byte << 1;
|
||||
gbyte |= 1;
|
||||
}
|
||||
|
||||
cur_bit = (gbyte >> (9-bit_pos)) & 1;
|
||||
cur_bit = (gbyte >> (9 - bit_pos)) & 1;
|
||||
|
||||
if (bit_pos == 9) {
|
||||
bit_pos = 0;
|
||||
byte_pos++;
|
||||
if (!shared_memory.afsk_alt_format)
|
||||
byte_pos++;
|
||||
else
|
||||
byte_pos += 2;
|
||||
} else {
|
||||
bit_pos++;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@ public:
|
||||
private:
|
||||
int8_t re, im;
|
||||
uint8_t s;
|
||||
uint8_t bit_pos, byte_pos = 0;
|
||||
uint8_t bit_pos = 0, byte_pos = 0;
|
||||
char cur_byte = 0;
|
||||
char ext_byte = 0;
|
||||
uint16_t gbyte;
|
||||
uint8_t cur_bit = 0;
|
||||
uint32_t sample_count;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
void JammerProcessor::execute(const buffer_c8_t& buffer) {
|
||||
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
|
||||
s = 0;
|
||||
for (;;) {
|
||||
ir++;
|
||||
|
||||
@@ -39,7 +39,7 @@ void XylosProcessor::execute(const buffer_c8_t& buffer) {
|
||||
for (size_t i = 0; i<buffer.count; i++) {
|
||||
|
||||
// Sample generation rate: 1536000/10 = 153kHz
|
||||
if (s >= 9) {
|
||||
if (s >= (5-1)) {
|
||||
s = 0;
|
||||
|
||||
if (silence) {
|
||||
@@ -78,7 +78,7 @@ void XylosProcessor::execute(const buffer_c8_t& buffer) {
|
||||
re = 0;
|
||||
im = 0;
|
||||
} else {
|
||||
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*255);
|
||||
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*127); // 255 here before :D
|
||||
|
||||
// Audio preview sample generation: 1536000/48000 = 32
|
||||
/*if (as >= 31) {
|
||||
@@ -87,15 +87,15 @@ void XylosProcessor::execute(const buffer_c8_t& buffer) {
|
||||
} else {
|
||||
as++;
|
||||
}*/
|
||||
|
||||
|
||||
//FM
|
||||
frq = sample * 500; // To check !
|
||||
frq = sample * 1000; // 500 was here
|
||||
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (256<<16);
|
||||
|
||||
re = (sine_table_f32[(sphase & 0x03FF0000)>>18]*127);
|
||||
im = (sine_table_f32[(phase & 0x03FF0000)>>18]*127);
|
||||
re = (sine_table_f32[(sphase & 0x03FF0000)>>18]*15);
|
||||
im = (sine_table_f32[(phase & 0x03FF0000)>>18]*15);
|
||||
}
|
||||
|
||||
buffer.p[i] = {(int8_t)re,(int8_t)im};
|
||||
|
||||
@@ -31,23 +31,15 @@
|
||||
#include "audio_output.hpp"
|
||||
#include "baseband_processor.hpp"
|
||||
|
||||
#define CCIR_TONELENGTH 15360-1 // 1536000/10/10
|
||||
#define PHASEV 436.91 // (65536*1024)/1536000*10
|
||||
#define SILENCE 61440-1 // 400ms
|
||||
#define CCIR_TONELENGTH (15360*2)-1 // 1536000/10/10
|
||||
#define PHASEV (436.91/2) // (65536*1024)/1536000*10
|
||||
#define SILENCE (46080*2)-1 // 400ms
|
||||
|
||||
class XylosProcessor : public BasebandProcessor {
|
||||
public:
|
||||
void execute(const buffer_c8_t& buffer) override;
|
||||
|
||||
private:
|
||||
/*int16_t audio_data[64];
|
||||
|
||||
std::array<int16_t, 64> audio;
|
||||
const buffer_s16_t audio_buffer {
|
||||
audio.data(),
|
||||
audio.size()
|
||||
};*/
|
||||
|
||||
uint32_t ccir_phases[16] = {
|
||||
(uint32_t)(1981*PHASEV),
|
||||
(uint32_t)(1124*PHASEV),
|
||||
|
||||
Reference in New Issue
Block a user