mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-06 08:45:01 -04:00
Single function to configure/enable radio.
This commit is contained in:
parent
692a262f41
commit
49a89b9dee
5 changed files with 54 additions and 24 deletions
|
@ -341,14 +341,16 @@ AISAppView::AISAppView(NavigationView&) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
set_target_frequency(initial_target_frequency);
|
target_frequency_ = initial_target_frequency;
|
||||||
radio::set_rf_amp(false);
|
|
||||||
radio::set_lna_gain(32);
|
radio::enable({
|
||||||
radio::set_vga_gain(32);
|
tuning_frequency(),
|
||||||
radio::set_baseband_rate(sampling_rate);
|
sampling_rate,
|
||||||
radio::set_baseband_decimation_by(1);
|
baseband_bandwidth,
|
||||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
rf::Direction::Receive,
|
||||||
radio::set_direction(rf::Direction::Receive);
|
false, 32, 32,
|
||||||
|
1,
|
||||||
|
});
|
||||||
|
|
||||||
BasebandConfigurationMessage message { {
|
BasebandConfigurationMessage message { {
|
||||||
.mode = 3,
|
.mode = 3,
|
||||||
|
|
|
@ -131,14 +131,14 @@ ERTAppView::ERTAppView(NavigationView&) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
radio::set_tuning_frequency(initial_target_frequency);
|
radio::enable({
|
||||||
radio::set_rf_amp(false);
|
initial_target_frequency,
|
||||||
radio::set_lna_gain(32);
|
sampling_rate,
|
||||||
radio::set_vga_gain(32);
|
baseband_bandwidth,
|
||||||
radio::set_baseband_rate(sampling_rate);
|
rf::Direction::Receive,
|
||||||
radio::set_baseband_decimation_by(1);
|
false, 32, 32,
|
||||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
1,
|
||||||
radio::set_direction(rf::Direction::Receive);
|
});
|
||||||
|
|
||||||
BasebandConfigurationMessage message { {
|
BasebandConfigurationMessage message { {
|
||||||
.mode = 6,
|
.mode = 6,
|
||||||
|
|
|
@ -169,4 +169,19 @@ void disable() {
|
||||||
set_rf_amp(false);
|
set_rf_amp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enable(Configuration configuration) {
|
||||||
|
configure(configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
void configure(Configuration configuration) {
|
||||||
|
set_tuning_frequency(configuration.tuning_frequency);
|
||||||
|
set_rf_amp(configuration.rf_amp);
|
||||||
|
set_lna_gain(configuration.lna_gain);
|
||||||
|
set_vga_gain(configuration.vga_gain);
|
||||||
|
set_baseband_rate(configuration.baseband_rate);
|
||||||
|
set_baseband_decimation_by(configuration.baseband_decimation);
|
||||||
|
set_baseband_filter_bandwidth(configuration.baseband_filter_bandwidth);
|
||||||
|
set_direction(configuration.direction);
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace radio */
|
} /* namespace radio */
|
||||||
|
|
|
@ -32,6 +32,17 @@
|
||||||
|
|
||||||
namespace radio {
|
namespace radio {
|
||||||
|
|
||||||
|
struct Configuration {
|
||||||
|
rf::Frequency tuning_frequency;
|
||||||
|
uint32_t baseband_rate;
|
||||||
|
uint32_t baseband_filter_bandwidth;
|
||||||
|
rf::Direction direction;
|
||||||
|
bool rf_amp;
|
||||||
|
int8_t lna_gain;
|
||||||
|
int8_t vga_gain;
|
||||||
|
uint8_t baseband_decimation;
|
||||||
|
};
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void set_direction(const rf::Direction new_direction);
|
void set_direction(const rf::Direction new_direction);
|
||||||
|
@ -44,6 +55,8 @@ void set_baseband_rate(const uint32_t rate);
|
||||||
void set_baseband_decimation_by(const size_t n);
|
void set_baseband_decimation_by(const size_t n);
|
||||||
void set_antenna_bias(const bool on);
|
void set_antenna_bias(const bool on);
|
||||||
|
|
||||||
|
void enable(Configuration configuration);
|
||||||
|
void configure(Configuration configuration);
|
||||||
void disable();
|
void disable();
|
||||||
|
|
||||||
extern rffc507x::RFFC507x first_if;
|
extern rffc507x::RFFC507x first_if;
|
||||||
|
|
|
@ -238,14 +238,14 @@ TPMSAppView::TPMSAppView(NavigationView&) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
radio::set_tuning_frequency(tuning_frequency());
|
radio::enable({
|
||||||
radio::set_rf_amp(false);
|
tuning_frequency(),
|
||||||
radio::set_lna_gain(32);
|
sampling_rate,
|
||||||
radio::set_vga_gain(32);
|
baseband_bandwidth,
|
||||||
radio::set_baseband_rate(sampling_rate);
|
rf::Direction::Receive,
|
||||||
radio::set_baseband_decimation_by(1);
|
false, 32, 32,
|
||||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
1,
|
||||||
radio::set_direction(rf::Direction::Receive);
|
});
|
||||||
|
|
||||||
BasebandConfigurationMessage message { {
|
BasebandConfigurationMessage message { {
|
||||||
.mode = 5,
|
.mode = 5,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue