mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-04 23:45:26 +00:00
Reverted WFM mode to working state
TXView in ADSB TX Lockable TXView POCSAG TX bugfix with Alphanum and Numeric only Testing Labels widget
This commit is contained in:
parent
884d0c4f58
commit
0102a34286
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,8 +21,10 @@
|
||||
/firmware/application/application.bin
|
||||
/CMakeCache.txt
|
||||
/Makefile
|
||||
/firmware/Makefile
|
||||
/firmware/baseband/Makefile
|
||||
/firmware/bootstrap/Makefile
|
||||
/firmware/application/Makefile
|
||||
/firmware/application/portapack_cpld_data.cpp
|
||||
/firmware/application/hackrf_cpld_data.cpp
|
||||
/firmware/application/hackrf_cpld_data.hpp
|
||||
|
@ -78,7 +78,9 @@ void ADSBTxView::generate_frame() {
|
||||
button_callsign.set_text(callsign);
|
||||
}
|
||||
|
||||
void ADSBTxView::start_tx() {
|
||||
bool ADSBTxView::start_tx() {
|
||||
generate_frame();
|
||||
|
||||
transmitter_model.set_tuning_frequency(434000000); // FOR TESTING - DEBUG
|
||||
transmitter_model.set_sampling_rate(2000000U);
|
||||
transmitter_model.set_rf_amp(true);
|
||||
@ -89,6 +91,8 @@ void ADSBTxView::start_tx() {
|
||||
|
||||
memcpy(shared_memory.bb_data.data, adsb_bin, 112);
|
||||
baseband::set_adsb();
|
||||
|
||||
return false; // DEBUG
|
||||
}
|
||||
|
||||
void ADSBTxView::on_txdone(const int n) {
|
||||
@ -97,23 +101,16 @@ void ADSBTxView::on_txdone(const int n) {
|
||||
if (n == 200) {
|
||||
transmitter_model.disable();
|
||||
//progress.set_value(0);
|
||||
|
||||
tx_mode = IDLE;
|
||||
button_transmit.set_style(&style_val);
|
||||
button_transmit.set_text("START");
|
||||
} else {
|
||||
//progress.set_value(n);
|
||||
}
|
||||
}
|
||||
|
||||
ADSBTxView::ADSBTxView(NavigationView& nav) {
|
||||
(void)nav;
|
||||
uint32_t c;
|
||||
|
||||
baseband::run_image(portapack::spi_flash::image_tag_adsb_tx);
|
||||
|
||||
// http://openflights.org
|
||||
|
||||
add_children({
|
||||
&text_format,
|
||||
&options_format,
|
||||
@ -136,7 +133,7 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
||||
&field_squawk,
|
||||
&text_frame_a,
|
||||
&text_frame_b,
|
||||
&button_transmit
|
||||
&tx_view
|
||||
});
|
||||
|
||||
options_format.set_by_value(17); // Mode S
|
||||
@ -164,19 +161,21 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
||||
for (c = 0; c < 4; c++)
|
||||
field_squawk.set_value(c, 0);
|
||||
|
||||
button_transmit.set_style(&style_val);
|
||||
|
||||
generate_frame();
|
||||
|
||||
// Single transmit
|
||||
button_transmit.on_select = [this, &nav](Button&) {
|
||||
if (tx_mode == IDLE) {
|
||||
tx_mode = SINGLE;
|
||||
button_transmit.set_style(&style_cancel);
|
||||
button_transmit.set_text("Wait");
|
||||
generate_frame();
|
||||
start_tx();
|
||||
}
|
||||
|
||||
tx_view.on_edit_frequency = [this, &nav]() {
|
||||
// Shouldn't be able to edit frequency
|
||||
return;
|
||||
};
|
||||
|
||||
tx_view.on_start = [this]() {
|
||||
if (start_tx())
|
||||
tx_view.set_transmitting(true);
|
||||
};
|
||||
|
||||
tx_view.on_stop = [this]() {
|
||||
tx_view.set_transmitting(false);
|
||||
transmitter_model.disable();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
#include "ui_transmitter.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
#include "transmitter_model.hpp"
|
||||
@ -57,7 +58,7 @@ private:
|
||||
uint8_t adsb_frame[14]; // 112 bit data block as 14 bytes
|
||||
uint8_t adsb_bin[112]; // 112 bit data block
|
||||
|
||||
void start_tx();
|
||||
bool start_tx();
|
||||
void generate_frame();
|
||||
void generate_frame_pos();
|
||||
void on_txdone(const int n);
|
||||
@ -170,9 +171,11 @@ private:
|
||||
"-"
|
||||
};
|
||||
|
||||
Button button_transmit {
|
||||
{ 2 * 8, 16 * 16, 64, 32 },
|
||||
"START"
|
||||
TransmitterView tx_view {
|
||||
16 * 16,
|
||||
1090000000,
|
||||
2000000,
|
||||
true
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_tx_done {
|
||||
|
@ -33,7 +33,7 @@ namespace ui {
|
||||
|
||||
class HandWriteView : public View {
|
||||
public:
|
||||
std::function<void(char *)> on_changed;
|
||||
std::function<void(char *)> on_changed { };
|
||||
|
||||
HandWriteView(NavigationView& nav, char txt[], size_t max_length);
|
||||
|
||||
@ -51,19 +51,19 @@ public:
|
||||
std::string title() const override { return "Text entry"; };
|
||||
|
||||
private:
|
||||
const HandWriting * handwriting;
|
||||
Painter * _painter;
|
||||
const HandWriting * handwriting { };
|
||||
Painter * _painter { };
|
||||
size_t _max_length;
|
||||
uint8_t dir_cnt = 0;
|
||||
uint8_t dir_prev;
|
||||
uint8_t flash_timer = 0;
|
||||
uint8_t txtidx = 0;
|
||||
bool cursor = false;
|
||||
bool tracing = false;
|
||||
uint8_t stroke_index;
|
||||
uint8_t sample_skip, move_wait;
|
||||
uint8_t dir_cnt { 0 };
|
||||
uint8_t dir_prev { 0 };
|
||||
uint8_t flash_timer { 0 };
|
||||
uint8_t txtidx { 0 };
|
||||
bool cursor { false };
|
||||
bool tracing { false };
|
||||
uint8_t stroke_index { 0 };
|
||||
uint8_t sample_skip { 0 }, move_wait { 0 };
|
||||
uint8_t stroke_list[8];
|
||||
Point start_pos, current_pos, last_pos;
|
||||
Point start_pos { }, current_pos { }, last_pos { };
|
||||
bool _lowercase = false;
|
||||
char txtinput[29] = { 0 }; // 28 chars max
|
||||
|
||||
@ -79,8 +79,8 @@ private:
|
||||
{ 8, 0, 232, 16 }
|
||||
};
|
||||
|
||||
std::array<Button, 10> num_buttons;
|
||||
std::array<Button, 5> special_buttons;
|
||||
std::array<Button, 10> num_buttons { };
|
||||
std::array<Button, 5> special_buttons { };
|
||||
|
||||
Button button_case {
|
||||
{ 8, 270, 32, 28 },
|
||||
|
@ -298,8 +298,8 @@ public:
|
||||
|
||||
private:
|
||||
bool entermode = false;
|
||||
uint32_t sequence = 0;
|
||||
uint8_t keycount, key_code;
|
||||
uint32_t sequence { 0 };
|
||||
uint8_t keycount { 0 }, key_code { };
|
||||
char sequence_txt[11] = { 0 };
|
||||
|
||||
Text text_sequence {
|
||||
|
@ -98,35 +98,45 @@ void TransmitterView::focus() {
|
||||
}
|
||||
|
||||
TransmitterView::TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
||||
) {
|
||||
const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock
|
||||
) : lock_ { lock }
|
||||
{
|
||||
set_parent_rect({ 0 * 8, y, 30 * 8, 6 * 8 });
|
||||
|
||||
add_children({
|
||||
&field_frequency,
|
||||
&text_gain,
|
||||
&field_gain,
|
||||
&field_bw,
|
||||
&text_kHz,
|
||||
&button_start
|
||||
});
|
||||
|
||||
set_transmitting(false);
|
||||
|
||||
if (lock_) {
|
||||
field_frequency.set_focusable(false);
|
||||
field_frequency.set_style(&style_locked);
|
||||
} else {
|
||||
add_children({
|
||||
&field_bw,
|
||||
&text_kHz
|
||||
});
|
||||
|
||||
field_bw.on_change = [this](int32_t bandwidth) {
|
||||
on_bandwidth_changed(bandwidth);
|
||||
};
|
||||
field_bw.set_value(bandwidth);
|
||||
}
|
||||
|
||||
field_frequency.set_value(receiver_model.tuning_frequency());
|
||||
field_frequency.set_step(frequency_step);
|
||||
field_frequency.on_change = [this](rf::Frequency f) {
|
||||
this->on_tuning_frequency_changed(f);
|
||||
on_tuning_frequency_changed(f);
|
||||
};
|
||||
field_frequency.on_edit = [this]() {
|
||||
if (on_edit_frequency)
|
||||
on_edit_frequency();
|
||||
};
|
||||
|
||||
field_bw.on_change = [this](int32_t bandwidth) {
|
||||
transmitter_model.set_bandwidth(bandwidth);
|
||||
};
|
||||
field_bw.set_value(bandwidth);
|
||||
|
||||
button_start.on_select = [this](Button&){
|
||||
if (transmitting_) {
|
||||
if (on_stop)
|
||||
|
@ -52,7 +52,13 @@ public:
|
||||
std::function<void(void)> on_start { };
|
||||
std::function<void(void)> on_stop { };
|
||||
|
||||
TransmitterView(const Coord y, const uint32_t frequency_step, const uint32_t bandwidth);
|
||||
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock);
|
||||
TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
||||
) : TransmitterView { y, frequency_step, bandwidth, false }
|
||||
{
|
||||
}
|
||||
|
||||
~TransmitterView();
|
||||
|
||||
void on_show() override;
|
||||
@ -72,15 +78,25 @@ private:
|
||||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
const Style style_locked {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::dark_grey(),
|
||||
};
|
||||
|
||||
bool lock_ { false };
|
||||
bool transmitting_ { false };
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 0 * 8, 1 * 8 }
|
||||
};
|
||||
|
||||
Text text_gain {
|
||||
{ 0 * 8, 3 * 8, 5 * 8, 1 * 16 },
|
||||
"Gain:"
|
||||
};
|
||||
TXGainField field_gain {
|
||||
{ 10 * 8, 1 * 8 }
|
||||
{ 5 * 8, 3 * 8 }
|
||||
};
|
||||
|
||||
NumberField field_bw {
|
||||
|
@ -427,8 +427,6 @@ add_custom_command(
|
||||
|
||||
project(baseband)
|
||||
|
||||
message(${BASEBAND_IMAGES})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_NAME}.img
|
||||
COMMAND cat ${BASEBAND_IMAGES} > ${PROJECT_NAME}.img
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define __CHANNEL_STATS_COLLECTOR_H__
|
||||
|
||||
#include "dsp_types.hpp"
|
||||
#include "simd.hpp"
|
||||
#include "message.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
@ -36,7 +35,14 @@ class ChannelStatsCollector {
|
||||
public:
|
||||
template<typename Callback>
|
||||
void feed(const buffer_c16_t& src, Callback callback) {
|
||||
max_squared = compute_max_squared(src, max_squared);
|
||||
auto src_p = src.p;
|
||||
while(src_p < &src.p[src.count]) {
|
||||
const uint32_t sample = *__SIMD32(src_p)++;
|
||||
const uint32_t mag_sq = __SMUAD(sample, sample);
|
||||
if( mag_sq > max_squared ) {
|
||||
max_squared = mag_sq;
|
||||
}
|
||||
}
|
||||
count += src.count;
|
||||
|
||||
const size_t samples_per_update = src.sampling_rate * update_interval;
|
||||
@ -55,24 +61,6 @@ private:
|
||||
static constexpr float update_interval { 0.1f };
|
||||
uint32_t max_squared { 0 };
|
||||
size_t count { 0 };
|
||||
|
||||
static uint32_t compute_max_squared(
|
||||
const buffer_c16_t& src,
|
||||
uint32_t max_squared
|
||||
) {
|
||||
auto p = simd32_ptr(src.p);
|
||||
const auto end_p = simd32_ptr(&src.p[src.count]);
|
||||
|
||||
while(p < end_p) {
|
||||
const uint32_t sample = *(p++);
|
||||
const uint32_t mag_sq = __SMUAD(sample, sample);
|
||||
if( mag_sq > max_squared ) {
|
||||
max_squared = mag_sq;
|
||||
}
|
||||
}
|
||||
|
||||
return max_squared;
|
||||
}
|
||||
};
|
||||
|
||||
#endif/*__CHANNEL_STATS_COLLECTOR_H__*/
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
#include "dsp_decimate.hpp"
|
||||
|
||||
#include "simd.hpp"
|
||||
|
||||
#include <hal.h>
|
||||
|
||||
namespace dsp {
|
||||
@ -568,39 +566,39 @@ buffer_c16_t DecimateBy2CIC3::execute(
|
||||
uint32_t t1 = _iq0;
|
||||
uint32_t t2 = _iq1;
|
||||
const uint32_t taps = 0x00000003;
|
||||
auto s = simd32_ptr(&src.p[0]);
|
||||
auto d = simd32_ptr(&dst.p[0]);
|
||||
const auto d_end = simd32_ptr(&dst.p[src.count / 2]);
|
||||
auto s = src.p;
|
||||
auto d = dst.p;
|
||||
const auto d_end = &dst.p[src.count / 2];
|
||||
while(d < d_end) {
|
||||
uint32_t i = __SXTH(t1, 0); /* 1: I0 */
|
||||
uint32_t q = __SXTH(t1, 16); /* 1: Q0 */
|
||||
i = __SMLABB(t2, taps, i); /* 1: I1*3 + I0 */
|
||||
q = __SMLATB(t2, taps, q); /* 1: Q1*3 + Q0 */
|
||||
|
||||
const uint32_t t3 = *(s++); /* 3: Q2:I2 */
|
||||
const uint32_t t4 = *(s++); /* Q3:I3 */
|
||||
const uint32_t t3 = *__SIMD32(s)++; /* 3: Q2:I2 */
|
||||
const uint32_t t4 = *__SIMD32(s)++; /* Q3:I3 */
|
||||
|
||||
i = __SMLABB(t3, taps, i); /* 1: I2*3 + I1*3 + I0 */
|
||||
q = __SMLATB(t3, taps, q); /* 1: Q2*3 + Q1*3 + Q0 */
|
||||
int32_t si0 = __SXTAH(i, t4, 0); /* 1: I3 + Q2*3 + Q1*3 + Q0 */
|
||||
int32_t sq0 = __SXTAH(q, t4, 16); /* 1: Q3 + Q2*3 + Q1*3 + Q0 */
|
||||
i = __BFI(si0 / 8, sq0 / 8, 16, 16); /* 1: D2_Q0:D2_I0 */
|
||||
*(d++) = i; /* D2_Q0:D2_I0 */
|
||||
*__SIMD32(d)++ = i; /* D2_Q0:D2_I0 */
|
||||
|
||||
i = __SXTH(t3, 0); /* 1: I2 */
|
||||
q = __SXTH(t3, 16); /* 1: Q2 */
|
||||
i = __SMLABB(t4, taps, i); /* 1: I3*3 + I2 */
|
||||
q = __SMLATB(t4, taps, q); /* 1: Q3*3 + Q2 */
|
||||
|
||||
t1 = *(s++); /* 3: Q4:I4 */
|
||||
t2 = *(s++); /* Q5:I5 */
|
||||
t1 = *__SIMD32(s)++; /* 3: Q4:I4 */
|
||||
t2 = *__SIMD32(s)++; /* Q5:I5 */
|
||||
|
||||
i = __SMLABB(t1, taps, i); /* 1: I4*3 + I3*3 + I2 */
|
||||
q = __SMLATB(t1, taps, q); /* 1: Q4*3 + Q3*3 + Q2 */
|
||||
int32_t si1 = __SXTAH(i, t2, 0) ; /* 1: I5 + Q4*3 + Q3*3 + Q2 */
|
||||
int32_t sq1 = __SXTAH(q, t2, 16); /* 1: Q5 + Q4*3 + Q3*3 + Q2 */
|
||||
i = __BFI(si1 / 8, sq1 / 8, 16, 16); /* 1: D2_Q1:D2_I1 */
|
||||
*(d++) = i; /* D2_Q1:D2_I1 */
|
||||
*__SIMD32(d)++ = i; /* D2_Q1:D2_I1 */
|
||||
}
|
||||
_iq0 = t1;
|
||||
_iq1 = t2;
|
||||
@ -667,57 +665,57 @@ buffer_c16_t FIRAndDecimateComplex::execute(
|
||||
const auto output_sampling_rate = src.sampling_rate / decimation_factor_;
|
||||
const size_t output_samples = src.count / decimation_factor_;
|
||||
|
||||
auto dst_p = simd32_ptr(dst.p);
|
||||
sample_t* dst_p = dst.p;
|
||||
const buffer_c16_t result { dst.p, output_samples, output_sampling_rate };
|
||||
|
||||
auto src_p = simd32_ptr(src.p);
|
||||
const sample_t* src_p = src.p;
|
||||
size_t outer_count = output_samples;
|
||||
while(outer_count > 0) {
|
||||
/* Put new samples into delay buffer */
|
||||
auto z_new_p = simd32_ptr(&samples_[taps_count_ - decimation_factor_]);
|
||||
auto z_new_p = &samples_[taps_count_ - decimation_factor_];
|
||||
for(size_t i=0; i<decimation_factor_; i++) {
|
||||
*(z_new_p++) = *(src_p++);
|
||||
*__SIMD32(z_new_p)++ = *__SIMD32(src_p)++;
|
||||
}
|
||||
|
||||
size_t loop_count = taps_count_ / 8;
|
||||
auto t_p = simd32_ptr(&taps_reversed_[0]);
|
||||
auto z_p = simd32_ptr(&samples_[0]);
|
||||
auto t_p = &taps_reversed_[0];
|
||||
auto z_p = &samples_[0];
|
||||
|
||||
int64_t t_real = 0;
|
||||
int64_t t_imag = 0;
|
||||
|
||||
while(loop_count > 0) {
|
||||
const auto tap0 = *(t_p++);
|
||||
const auto sample0 = *(z_p++);
|
||||
const auto tap1 = *(t_p++);
|
||||
const auto sample1 = *(z_p++);
|
||||
const auto tap0 = *__SIMD32(t_p)++;
|
||||
const auto sample0 = *__SIMD32(z_p)++;
|
||||
const auto tap1 = *__SIMD32(t_p)++;
|
||||
const auto sample1 = *__SIMD32(z_p)++;
|
||||
t_real = __SMLSLD(sample0, tap0, t_real);
|
||||
t_imag = __SMLALDX(sample0, tap0, t_imag);
|
||||
t_real = __SMLSLD(sample1, tap1, t_real);
|
||||
t_imag = __SMLALDX(sample1, tap1, t_imag);
|
||||
|
||||
const auto tap2 = *(t_p++);
|
||||
const auto sample2 = *(z_p++);
|
||||
const auto tap3 = *(t_p++);
|
||||
const auto sample3 = *(z_p++);
|
||||
const auto tap2 = *__SIMD32(t_p)++;
|
||||
const auto sample2 = *__SIMD32(z_p)++;
|
||||
const auto tap3 = *__SIMD32(t_p)++;
|
||||
const auto sample3 = *__SIMD32(z_p)++;
|
||||
t_real = __SMLSLD(sample2, tap2, t_real);
|
||||
t_imag = __SMLALDX(sample2, tap2, t_imag);
|
||||
t_real = __SMLSLD(sample3, tap3, t_real);
|
||||
t_imag = __SMLALDX(sample3, tap3, t_imag);
|
||||
|
||||
const auto tap4 = *(t_p++);
|
||||
const auto sample4 = *(z_p++);
|
||||
const auto tap5 = *(t_p++);
|
||||
const auto sample5 = *(z_p++);
|
||||
const auto tap4 = *__SIMD32(t_p)++;
|
||||
const auto sample4 = *__SIMD32(z_p)++;
|
||||
const auto tap5 = *__SIMD32(t_p)++;
|
||||
const auto sample5 = *__SIMD32(z_p)++;
|
||||
t_real = __SMLSLD(sample4, tap4, t_real);
|
||||
t_imag = __SMLALDX(sample4, tap4, t_imag);
|
||||
t_real = __SMLSLD(sample5, tap5, t_real);
|
||||
t_imag = __SMLALDX(sample5, tap5, t_imag);
|
||||
|
||||
const auto tap6 = *(t_p++);
|
||||
const auto sample6 = *(z_p++);
|
||||
const auto tap7 = *(t_p++);
|
||||
const auto sample7 = *(z_p++);
|
||||
const auto tap6 = *__SIMD32(t_p)++;
|
||||
const auto sample6 = *__SIMD32(z_p)++;
|
||||
const auto tap7 = *__SIMD32(t_p)++;
|
||||
const auto sample7 = *__SIMD32(z_p)++;
|
||||
t_real = __SMLSLD(sample6, tap6, t_real);
|
||||
t_imag = __SMLALDX(sample6, tap6, t_imag);
|
||||
t_real = __SMLSLD(sample7, tap7, t_real);
|
||||
@ -733,7 +731,7 @@ buffer_c16_t FIRAndDecimateComplex::execute(
|
||||
const int32_t i = t_imag >> 16;
|
||||
const int32_t r_sat = __SSAT(r, 16);
|
||||
const int32_t i_sat = __SSAT(i, 16);
|
||||
*(dst_p++) = __PKHBT(
|
||||
*__SIMD32(dst_p)++ = __PKHBT(
|
||||
r_sat,
|
||||
i_sat,
|
||||
16
|
||||
@ -743,14 +741,14 @@ buffer_c16_t FIRAndDecimateComplex::execute(
|
||||
const size_t unroll_factor = 4;
|
||||
size_t shift_count = (taps_count_ - decimation_factor_) / unroll_factor;
|
||||
|
||||
auto t = simd32_ptr(&samples_[0]);
|
||||
auto s = simd32_ptr(&samples_[decimation_factor_]);
|
||||
sample_t* t = &samples_[0];
|
||||
const sample_t* s = &samples_[decimation_factor_];
|
||||
|
||||
while(shift_count > 0) {
|
||||
*(t++) = *(s++);
|
||||
*(t++) = *(s++);
|
||||
*(t++) = *(s++);
|
||||
*(t++) = *(s++);
|
||||
*__SIMD32(t)++ = *__SIMD32(s)++;
|
||||
*__SIMD32(t)++ = *__SIMD32(s)++;
|
||||
*__SIMD32(t)++ = *__SIMD32(s)++;
|
||||
*__SIMD32(t)++ = *__SIMD32(s)++;
|
||||
shift_count--;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "complex.hpp"
|
||||
#include "fxpt_atan2.hpp"
|
||||
#include "utility_m4.hpp"
|
||||
#include "simd.hpp"
|
||||
|
||||
#include <hal.h>
|
||||
|
||||
@ -35,12 +34,12 @@ buffer_f32_t AM::execute(
|
||||
const buffer_c16_t& src,
|
||||
const buffer_f32_t& dst
|
||||
) {
|
||||
auto src_p = simd32_ptr(src.p);
|
||||
auto src_end = simd32_ptr(&src.p[src.count]);
|
||||
const auto src_p = src.p;
|
||||
const auto src_end = &src.p[src.count];
|
||||
auto dst_p = dst.p;
|
||||
while(src_p < src_end) {
|
||||
const uint32_t sample0 = *(src_p++);
|
||||
const uint32_t sample1 = *(src_p++);
|
||||
const uint32_t sample0 = *__SIMD32(src_p)++;
|
||||
const uint32_t sample1 = *__SIMD32(src_p)++;
|
||||
const uint32_t mag_sq0 = __SMUAD(sample0, sample0);
|
||||
const uint32_t mag_sq1 = __SMUAD(sample1, sample1);
|
||||
*(dst_p++) = __builtin_sqrtf(mag_sq0) * k;
|
||||
@ -91,12 +90,12 @@ buffer_f32_t FM::execute(
|
||||
) {
|
||||
auto z = z_;
|
||||
|
||||
auto src_p = simd32_ptr(src.p);
|
||||
auto src_end = simd32_ptr(&src.p[src.count]);
|
||||
const auto src_p = src.p;
|
||||
const auto src_end = &src.p[src.count];
|
||||
auto dst_p = dst.p;
|
||||
while(src_p < src_end) {
|
||||
const auto s0 = *(src_p++);
|
||||
const auto s1 = *(src_p++);
|
||||
const auto s0 = *__SIMD32(src_p)++;
|
||||
const auto s1 = *__SIMD32(src_p)++;
|
||||
const auto t0 = multiply_conjugate_s16_s32(s0, z);
|
||||
const auto t1 = multiply_conjugate_s16_s32(s1, s0);
|
||||
z = s1;
|
||||
@ -114,12 +113,12 @@ buffer_s16_t FM::execute(
|
||||
) {
|
||||
auto z = z_;
|
||||
|
||||
auto src_p = simd32_ptr(src.p);
|
||||
auto src_end = simd32_ptr(&src.p[src.count]);
|
||||
const auto src_p = src.p;
|
||||
const auto src_end = &src.p[src.count];
|
||||
auto dst_p = dst.p;
|
||||
while(src_p < src_end) {
|
||||
const auto s0 = *(src_p++);
|
||||
const auto s1 = *(src_p++);
|
||||
const auto s0 = *__SIMD32(src_p)++;
|
||||
const auto s1 = *__SIMD32(src_p)++;
|
||||
const auto t0 = multiply_conjugate_s16_s32(s0, z);
|
||||
const auto t1 = multiply_conjugate_s16_s32(s1, s0);
|
||||
z = s1;
|
||||
@ -127,7 +126,7 @@ buffer_s16_t FM::execute(
|
||||
const int32_t theta0_sat = __SSAT(theta0_int, 16);
|
||||
const int32_t theta1_int = angle_approx_0deg27(t1) * ks16;
|
||||
const int32_t theta1_sat = __SSAT(theta1_int, 16);
|
||||
*(dst_p++) = __PKHBT(
|
||||
*__SIMD32(dst_p)++ = __PKHBT(
|
||||
theta0_sat,
|
||||
theta1_sat,
|
||||
16
|
||||
|
@ -37,7 +37,7 @@ void FSKProcessor::execute(const buffer_c8_t& buffer) {
|
||||
for (size_t i = 0; i < buffer.count; i++) {
|
||||
|
||||
if (sample_count >= samples_per_bit) {
|
||||
if (bit_pos >= length) {
|
||||
if (bit_pos > length) {
|
||||
// End of data
|
||||
cur_bit = 0;
|
||||
txdone_message.done = true;
|
||||
@ -83,7 +83,7 @@ void FSKProcessor::on_message(const Message* const p) {
|
||||
|
||||
if (message.id == Message::ID::FSKConfigure) {
|
||||
samples_per_bit = message.samples_per_bit;
|
||||
length = message.stream_length - 1;
|
||||
length = message.stream_length + 4; // Why 4 ?!
|
||||
|
||||
shift_zero = message.shift * (0xFFFFFFFFULL / 2280000);
|
||||
shift_one = -shift_zero;
|
||||
|
@ -125,6 +125,12 @@ typedef enum IRQn {
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* NOTE: Override old, misbehaving SIMD #defines */
|
||||
|
||||
#define __SIMD32_TYPE int32_t
|
||||
#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
|
||||
#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
|
||||
|
||||
/* Overload of __SXTB16() to add ROR argument, since using __ROR() as an
|
||||
* argument to the existing __SXTB16() doesn't produce optimum/sane code.
|
||||
*/
|
||||
|
@ -110,7 +110,7 @@ void pocsag_encode(
|
||||
size_t b, c, address_slot;
|
||||
size_t bit_idx, char_idx = 0;
|
||||
uint32_t codeword, digit_code;
|
||||
char ascii_char;
|
||||
char ascii_char = 0;
|
||||
|
||||
size_t message_size = message.size();
|
||||
|
||||
@ -140,6 +140,7 @@ void pocsag_encode(
|
||||
|
||||
if (type == MessageType::ADDRESS_ONLY) return; // Done.
|
||||
|
||||
c++;
|
||||
codeword = 0;
|
||||
bit_idx = 20 + 11;
|
||||
|
||||
|
@ -349,6 +349,32 @@ void Text::paint(Painter& painter) {
|
||||
);
|
||||
}
|
||||
|
||||
/* Labels ****************************************************************/
|
||||
|
||||
Labels::Labels(
|
||||
std::vector<Label> * labels
|
||||
) : labels_ { labels }
|
||||
{
|
||||
}
|
||||
|
||||
void Labels::set_labels(std::vector<Label> * const labels) {
|
||||
labels_ = labels;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void Labels::paint(Painter& painter) {
|
||||
/*const auto rect = screen_rect();
|
||||
const auto s = style();
|
||||
|
||||
painter.fill_rectangle(rect, s.background);
|
||||
|
||||
painter.draw_string(
|
||||
rect.location(),
|
||||
s,
|
||||
text
|
||||
);*/
|
||||
}
|
||||
|
||||
/* BigFrequency **********************************************************/
|
||||
|
||||
const uint8_t big_segment_font[11] = {
|
||||
|
@ -211,6 +211,29 @@ private:
|
||||
std::string text;
|
||||
};
|
||||
|
||||
class Labels : public Widget {
|
||||
public:
|
||||
struct Label {
|
||||
Point pos;
|
||||
std::string text;
|
||||
ui::Color color;
|
||||
};
|
||||
|
||||
Labels(const Labels&) = delete;
|
||||
Labels(Labels&&) = delete;
|
||||
Labels& operator=(const Labels&) = delete;
|
||||
Labels& operator=(Labels&&) = delete;
|
||||
|
||||
Labels(std::vector<Label> * labels);
|
||||
|
||||
void set_labels(std::vector<Label> * const labels);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
std::vector<Label> * labels_;
|
||||
};
|
||||
|
||||
class BigFrequency : public Widget {
|
||||
public:
|
||||
BigFrequency(Rect parent_rect, rf::Frequency frequency);
|
||||
@ -294,7 +317,7 @@ private:
|
||||
std::string text_;
|
||||
bool small_ { false };
|
||||
bool value_ { false };
|
||||
const Style* style_ { nullptr };
|
||||
const Style * style_ { nullptr };
|
||||
};
|
||||
|
||||
class Button : public Widget {
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user