diff --git a/TNC/AFSKModulator.cpp b/TNC/AFSKModulator.cpp index e169216..d4d1c66 100644 --- a/TNC/AFSKModulator.cpp +++ b/TNC/AFSKModulator.cpp @@ -9,11 +9,7 @@ void AFSKModulator::init(const kiss::Hardware& hw) { set_twist(hw.tx_twist); - if (HAL_RCC_GetHCLKFreq() != 48000000) - { - ERROR("Clock is not 48MHz"); - CxxErrorHandler(); - } + SysClock48(); // Configure 48MHz clock for 26.4ksps. htim7.Init.Period = 1817; diff --git a/TNC/Fsk9600Demodulator.hpp b/TNC/Fsk9600Demodulator.hpp index 5abe2dd..a4ce20d 100644 --- a/TNC/Fsk9600Demodulator.hpp +++ b/TNC/Fsk9600Demodulator.hpp @@ -51,7 +51,6 @@ struct Fsk9600Demodulator : IDemodulator void start() override { - INFO("Setting 80MHz SysClock."); SysClock80(); auto const& bpf_coeffs = bpf_bank[kiss::settings().rx_twist + 3]; diff --git a/TNC/Fsk9600Modulator.cpp b/TNC/Fsk9600Modulator.cpp index e04f2c0..2f2d7b7 100644 --- a/TNC/Fsk9600Modulator.cpp +++ b/TNC/Fsk9600Modulator.cpp @@ -6,16 +6,26 @@ namespace mobilinkd { namespace tnc { /* + * Cosine. const Fsk9600Modulator::cos_table_type Fsk9600Modulator::cos_table = { 2047, 2020, 1937, 1801, 1616, 1387, 1120, 822, 502, 169, -169, -502, -822, -1120, -1387, -1616, -1801, -1937, -2020, -2048 }; */ +/* + * Square wave -- filtered in hardware at 7200Hz const Fsk9600Modulator::cos_table_type Fsk9600Modulator::cos_table = { 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, -2048, -2048, -2048, -2048, -2048, -2048, -2048, -2048, -2048, -2048 }; +*/ + +// Gaussian +const Fsk9600Modulator::cos_table_type Fsk9600Modulator::cos_table = { + 2042, 2027, 1995, 1931, 1815, 1626, 1345, 968, 507, 0, + -507, -968, -1345, -1626, -1815, -1931, -1995, -2027, -2042, -2048 +}; void Fsk9600Modulator::init(const kiss::Hardware& hw) { @@ -26,11 +36,7 @@ void Fsk9600Modulator::init(const kiss::Hardware& hw) state = State::STOPPED; level = Level::HIGH; - if (HAL_RCC_GetHCLKFreq() != 80000000) - { - ERROR("Clock is not 80MHz"); - CxxErrorHandler(); - } + SysClock80(); // Configure 80MHz clock for 192ksps. htim7.Init.Period = 416; diff --git a/TNC/Fsk9600Modulator.hpp b/TNC/Fsk9600Modulator.hpp index aceeaf9..5bc53d2 100644 --- a/TNC/Fsk9600Modulator.hpp +++ b/TNC/Fsk9600Modulator.hpp @@ -211,8 +211,8 @@ private: case Level::LOW: if (bit) { - std::transform(cos_table.rbegin(), cos_table.rend(), buffer, - [this](auto x){return adjust_level(x);}); + std::transform(cos_table.begin(), cos_table.end(), buffer, + [this](auto x){return adjust_level(-1 - x);}); level = Level::HIGH; } else