Completely useless "about" screen

Paved road for talking Xylos RX and logger
Added test button for Xylos TX
Fixed jammer crashing after loading second time
This commit is contained in:
furrtek
2016-01-30 00:28:05 +01:00
parent 1e71a10346
commit 107c212d88
64 changed files with 3599 additions and 56 deletions
+2
View File
@@ -137,6 +137,8 @@ CPPSRC = main.cpp \
proc_jammer.cpp \
proc_fsk_lcr.cpp \
proc_xylos.cpp \
proc_audiotx.cpp \
proc_playaudio.cpp \
dsp_squelch.cpp \
clock_recovery.cpp \
packet_builder.cpp \
@@ -120,3 +120,7 @@ void BasebandProcessor::post_audio_stats_message(const AudioStatistics statistic
audio_stats_message.statistics = statistics;
shared_memory.application_queue.push(audio_stats_message);
}
void BasebandProcessor::fill_buffer(int8_t * inptr) {
(void)inptr;
}
@@ -38,6 +38,7 @@ public:
virtual ~BasebandProcessor() = default;
virtual void execute(buffer_c8_t buffer) = 0;
virtual void fill_buffer(int8_t * inptr);
void update_spectrum();
+14 -2
View File
@@ -15,6 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* 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.
*/
@@ -53,6 +54,7 @@
#include "proc_fsk_lcr.hpp"
#include "proc_jammer.hpp"
#include "proc_xylos.hpp"
#include "proc_playaudio.hpp"
#include "clock_recovery.hpp"
#include "packet_builder.hpp"
@@ -121,7 +123,6 @@ private:
WORKING_AREA(wa, 2048);
void run() override {
while(true) {
if (direction == baseband::Direction::Transmit) {
const auto buffer_tmp = baseband::dma::wait_for_tx_buffer();
@@ -497,7 +498,7 @@ int main(void) {
auto& message_handlers = event_dispatcher.message_handlers();
message_handlers.register_handler(Message::ID::ModuleID,
[&message_handlers](Message* p) {
[](Message* p) {
ModuleIDMessage reply;
auto message = static_cast<ModuleIDMessage*>(p);
if (message->query == true) { // Shouldn't be needed
@@ -549,6 +550,17 @@ int main(void) {
baseband_thread.baseband_processor = new XylosProcessor();
break;
case PLAY_AUDIO:
direction = baseband::Direction::Transmit;
baseband_thread.baseband_processor = new PlayAudioProcessor();
message_handlers.register_handler(Message::ID::FIFOData,
[](Message* p) {
auto message = static_cast<FIFODataMessage*>(p);
baseband_thread.baseband_processor->fill_buffer(message->data);
}
);
break;
case SWITCH:
wait_for_switch();
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2015 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_audiotx.hpp"
#include "portapack_shared_memory.hpp"
#include "sine_table.hpp"
#include <cstdint>
void AudioTXProcessor::execute(buffer_c8_t buffer) {
}
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2015 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_AUDIOTX_H__
#define __PROC_AUDIOTX_H__
#include "baseband_processor.hpp"
#define SAMPLERATE 44100/4
class AudioTXProcessor : public BasebandProcessor {
public:
void execute(buffer_c8_t buffer) override;
private:
int8_t audio_fifo[SAMPLERATE];
int8_t re, im;
uint8_t s, as = 0, ai;
uint8_t byte_pos = 0;
uint8_t digit = 0;
uint32_t aphase, phase, sphase;
int32_t sample, frq;
TXDoneMessage message;
};
#endif
+73
View File
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2015 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_playaudio.hpp"
#include "portapack_shared_memory.hpp"
#include "sine_table.hpp"
#include <cstdint>
// This is diry :(
void PlayAudioProcessor::fill_buffer(int8_t * inptr) {
memcpy(&audio_fifo[fifo_put], inptr, 1024);
fifo_put = (fifo_put + 1024) & 0x0FFF;
asked = false;
}
void PlayAudioProcessor::execute(buffer_c8_t buffer) {
// This is called at 1536000/2048 = 750Hz
ai = 0;
for (size_t i = 0; i<buffer.count; i++) {
// Audio preview sample generation: 1536000/48000 = 32
if (as >= 31) {
as = 0;
sample = audio_fifo[fifo_get];
preview_audio_buffer.p[ai++] = sample << 8;
fifo_get = (fifo_get + 1) & 0x0FFF;
if ((((fifo_put - fifo_get) & 0x0FFF) < 3072) && (asked == false)) {
// Ask application to fill up fifo
sigmessage.signaltype = 1;
shared_memory.application_queue.push(sigmessage);
asked = true;
}
} else {
as++;
}
sample = ((int8_t)audio_fifo[fifo_get] * 4);
//FM
frq = sample * 2000;
phase = (phase + frq);
sphase = phase + (256<<16);
re = (sine_table_f32[(sphase & 0x03FF0000)>>18]*127);
im = (sine_table_f32[(phase & 0x03FF0000)>>18]*127);
buffer.p[i] = {(int8_t)re,(int8_t)im};
}
fill_audio_buffer(preview_audio_buffer);
}
+56
View File
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2015 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_PLAYAUDIO_H__
#define __PROC_PLAYAUDIO_H__
#include "baseband_processor.hpp"
class PlayAudioProcessor : public BasebandProcessor {
public:
void execute(buffer_c8_t buffer) override;
void fill_buffer(int8_t * inptr);
private:
int8_t audio_fifo[4096]; // Probably too much (=85ms @ 48000Hz)
uint16_t fifo_put, fifo_get;
uint8_t as = 0, ai;
int8_t re, im;
int16_t st;
int16_t audio_data[64];
bool asked = false;
const buffer_s16_t preview_audio_buffer {
audio_data,
sizeof(int16_t)*64
};
FIFOSignalMessage sigmessage;
uint32_t aphase, phase, sphase;
int32_t sample, frq;
};
#endif
+5
View File
@@ -26,6 +26,11 @@
#include <cstdint>
// 1990 1131 1201 1275 1357 ...
// 14 13 12 11:
// 2108 989 2259 931
void XylosProcessor::execute(buffer_c8_t buffer) {
// This is called at 1536000/2048 = 750Hz
+1 -1
View File
@@ -39,7 +39,7 @@ private:
audio_data,
sizeof(int16_t)*64
};
uint32_t ccir_phases[16] = {
(uint32_t)(1981*PHASEV),
(uint32_t)(1124*PHASEV),