Added missing files, ENUMed modulation modes

This commit is contained in:
furrtek
2016-01-05 11:47:46 +01:00
parent 9b8b8cc83f
commit 3477a2691a
34 changed files with 583 additions and 98 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ constexpr gpdma::channel::Config config_rx() {
/* TODO: Clean up terminology around "buffer", "transfer", "samples" */
constexpr size_t buffer_samples_log2n = 7;
constexpr size_t buffer_samples_log2n = 8; // Bumped to 8, to allow filling at 750Hz
constexpr size_t buffer_samples = (1 << buffer_samples_log2n);
constexpr size_t transfers_per_buffer_log2n = 2;
constexpr size_t transfers_per_buffer = (1 << transfers_per_buffer_log2n);
+27 -5
View File
@@ -38,6 +38,8 @@
#include "touch_dma.hpp"
#include "modules.h"
#include "dsp_decimate.hpp"
#include "dsp_demodulate.hpp"
#include "dsp_fft.hpp"
@@ -468,6 +470,23 @@ private:
const auto baseband_buffer =
new std::array<baseband::sample_t, 8192>();
char ram_loop[32];
typedef int (*fn_ptr)(void);
fn_ptr loop_ptr;
void ram_loop_fn(void) {
while(1) {}
}
void wait_for_switch(void) {
memcpy(&ram_loop[0], reinterpret_cast<char*>(&ram_loop_fn), 32);
loop_ptr = reinterpret_cast<fn_ptr>(&ram_loop[0]);
ReadyForSwitchMessage message;
shared_memory.application_queue.push(message);
(*loop_ptr)();
return;
}
int main(void) {
init();
@@ -494,30 +513,33 @@ int main(void) {
delete old_p;
switch(message->configuration.mode) {
case 15:
case TX_RDS:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new RDSProcessor();
break;
case 16:
case TX_LCR:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new LCRFSKProcessor();
break;
case 17:
case TX_TONE:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new ToneProcessor();
break;
case 18:
case TX_JAMMER:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new JammerProcessor();
break;
case 19:
case TX_XYLOS:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new XylosProcessor();
break;
case 0xFF:
wait_for_switch();
default:
break;
+21 -8
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*
@@ -27,27 +28,29 @@
void XylosProcessor::execute(buffer_c8_t buffer) {
// This is called at 1536000/2048 = 750Hz
ai = 0;
for (size_t i = 0; i<buffer.count; i++) {
//Sample generation 2.28M/10 = 228kHz
// Sample generation rate: 1536000/10 = 153kHz
if (s >= 9) {
s = 0;
if (sample_count >= CCIR_TONELENGTH) {
if (shared_memory.xylos_transmit_done == false) {
message.n = byte_pos; // Progress
message.n = byte_pos; // Inform UI about progress (just as eye candy)
shared_memory.application_queue.push(message);
digit = shared_memory.xylosdata[byte_pos++];
}
if (!digit) {
message.n = 25; // Done code
message.n = 25; // End of message 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 {
@@ -59,10 +62,18 @@ void XylosProcessor::execute(buffer_c8_t buffer) {
s++;
}
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*255);
sample = (sine_table_f32[(aphase & 0x03FF0000)>>18]*255);
// Audio preview sample generation: 1536000/48000 = 32
if (as >= 31) {
as = 0;
preview_audio_buffer.p[ai++] = sample * 128;
} else {
as++;
}
//FM
frq = sample * 160; // 20kHz wide (?)
frq = sample * 300; // ~10kHz wide
phase = (phase + frq);
sphase = phase + (256<<16);
@@ -72,4 +83,6 @@ void XylosProcessor::execute(buffer_c8_t buffer) {
buffer.p[i] = {(int8_t)re,(int8_t)im};
}
fill_audio_buffer(preview_audio_buffer);
}
+27 -19
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*
@@ -24,35 +25,42 @@
#include "baseband_processor.hpp"
#define CCIR_TONELENGTH 22800
#define PHASEV 294.34
#define CCIR_TONELENGTH 15360-1 // 1536000/10/10
#define PHASEV 436.91 // (65536*1024)/1536000*10
class XylosProcessor : public BasebandProcessor {
public:
void execute(buffer_c8_t buffer) override;
private:
int16_t audio_data[64];
const buffer_s16_t preview_audio_buffer {
audio_data,
sizeof(int16_t)*64
};
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
(uint32_t)(1981*PHASEV),
(uint32_t)(1124*PHASEV),
(uint32_t)(1197*PHASEV),
(uint32_t)(1275*PHASEV),
(uint32_t)(1358*PHASEV),
(uint32_t)(1446*PHASEV),
(uint32_t)(1540*PHASEV),
(uint32_t)(1640*PHASEV),
(uint32_t)(1747*PHASEV),
(uint32_t)(1860*PHASEV),
(uint32_t)(2400*PHASEV),
(uint32_t)(930*PHASEV),
(uint32_t)(2247*PHASEV),
(uint32_t)(991*PHASEV),
(uint32_t)(2110*PHASEV),
(uint32_t)(1055*PHASEV)
};
int8_t re, im;
uint8_t s;
uint8_t s, as = 0, ai;
uint8_t byte_pos = 0;
uint8_t digit = 0;
uint32_t sample_count = CCIR_TONELENGTH;