Store PPM in shared memory for now.

This commit is contained in:
Clayton Smith 2015-07-26 12:39:03 -04:00 committed by Jared Boone
parent 9dd41ed48d
commit 3874c82d57
4 changed files with 7 additions and 2 deletions

View File

@ -618,6 +618,7 @@ int main(void) {
}
init_message_queues();
shared_memory.correction_ppm = 0;
portapack::io.init();
ui::Context context;

View File

@ -26,6 +26,7 @@
#include "max5864.hpp"
#include "baseband_cpld.hpp"
#include "baseband_sgpio.hpp"
#include "portapack_shared_memory.hpp"
#include "tuning.hpp"
@ -117,7 +118,7 @@ void set_direction(const rf::Direction new_direction) {
}
bool set_tuning_frequency(const rf::Frequency frequency) {
rf::Frequency corrected_frequency = frequency * (1000000 - 10) / 1000000;
rf::Frequency corrected_frequency = frequency * (1000000 + shared_memory.correction_ppm) / 1000000;
const auto tuning_config = tuning::config::create(corrected_frequency);
if( tuning_config.is_valid() ) {
first_if.disable();

View File

@ -21,6 +21,7 @@
#include "ui_setup.hpp"
#include "portapack_shared_memory.hpp"
#include "lpc43xx_cpp.hpp"
using namespace lpc43xx;
@ -103,6 +104,7 @@ SetFrequencyCorrectionView::SetFrequencyCorrectionView(
) {
button_ok.on_select = [&nav, this](Button&){
const auto model = this->form_collect();
shared_memory.correction_ppm = model.ppm;
nav.pop();
},
@ -119,7 +121,7 @@ SetFrequencyCorrectionView::SetFrequencyCorrectionView(
} });
SetFrequencyCorrectionModel model {
0
shared_memory.correction_ppm
};
form_init(model);

View File

@ -38,6 +38,7 @@ struct SharedMemory {
// TODO: M0 should directly configure and control DMA channel that is
// acquiring ADC samples.
TouchADCFrame touch_adc_frame;
int8_t correction_ppm;
};
extern SharedMemory& shared_memory;