mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Use PPB correction to adjust clock generator XTAL PLLA frequency.
Addresses issue #40.
This commit is contained in:
parent
fe7dcdc613
commit
8f326e2d8e
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
#include "portapack_hal.hpp"
|
#include "portapack_hal.hpp"
|
||||||
|
#include "portapack_persistent_memory.hpp"
|
||||||
|
|
||||||
#include "hackrf_hal.hpp"
|
#include "hackrf_hal.hpp"
|
||||||
#include "hackrf_gpio.hpp"
|
#include "hackrf_gpio.hpp"
|
||||||
@ -127,6 +128,7 @@ void init() {
|
|||||||
led_tx.setup();
|
led_tx.setup();
|
||||||
|
|
||||||
clock_manager.init();
|
clock_manager.init();
|
||||||
|
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
|
||||||
clock_manager.run_at_full_speed();
|
clock_manager.run_at_full_speed();
|
||||||
|
|
||||||
clock_manager.start_audio_pll();
|
clock_manager.start_audio_pll();
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
using namespace hackrf::one;
|
using namespace hackrf::one;
|
||||||
|
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
#include "portapack_persistent_memory.hpp"
|
|
||||||
|
|
||||||
namespace radio {
|
namespace radio {
|
||||||
|
|
||||||
@ -118,9 +117,7 @@ void set_direction(const rf::Direction new_direction) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool set_tuning_frequency(const rf::Frequency frequency) {
|
bool set_tuning_frequency(const rf::Frequency frequency) {
|
||||||
const int32_t frequency_correction = frequency * portapack::persistent_memory::correction_ppb() / 1000000000;
|
const auto tuning_config = tuning::config::create(frequency);
|
||||||
rf::Frequency corrected_frequency = frequency + frequency_correction;
|
|
||||||
const auto tuning_config = tuning::config::create(corrected_frequency);
|
|
||||||
if( tuning_config.is_valid() ) {
|
if( tuning_config.is_valid() ) {
|
||||||
first_if.disable();
|
first_if.disable();
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int32_t ReceiverModel::reference_ppm_correction() const {
|
|||||||
|
|
||||||
void ReceiverModel::set_reference_ppm_correction(int32_t v) {
|
void ReceiverModel::set_reference_ppm_correction(int32_t v) {
|
||||||
persistent_memory::set_correction_ppb(v * 1000);
|
persistent_memory::set_correction_ppb(v * 1000);
|
||||||
update_tuning_frequency();
|
clock_manager.set_reference_ppb(v * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReceiverModel::rf_amp() const {
|
bool ReceiverModel::rf_amp() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user