mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Single function to configure/enable radio.
This commit is contained in:
parent
692a262f41
commit
49a89b9dee
@ -341,14 +341,16 @@ AISAppView::AISAppView(NavigationView&) {
|
||||
}
|
||||
);
|
||||
|
||||
set_target_frequency(initial_target_frequency);
|
||||
radio::set_rf_amp(false);
|
||||
radio::set_lna_gain(32);
|
||||
radio::set_vga_gain(32);
|
||||
radio::set_baseband_rate(sampling_rate);
|
||||
radio::set_baseband_decimation_by(1);
|
||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
||||
radio::set_direction(rf::Direction::Receive);
|
||||
target_frequency_ = initial_target_frequency;
|
||||
|
||||
radio::enable({
|
||||
tuning_frequency(),
|
||||
sampling_rate,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Receive,
|
||||
false, 32, 32,
|
||||
1,
|
||||
});
|
||||
|
||||
BasebandConfigurationMessage message { {
|
||||
.mode = 3,
|
||||
|
@ -131,14 +131,14 @@ ERTAppView::ERTAppView(NavigationView&) {
|
||||
}
|
||||
);
|
||||
|
||||
radio::set_tuning_frequency(initial_target_frequency);
|
||||
radio::set_rf_amp(false);
|
||||
radio::set_lna_gain(32);
|
||||
radio::set_vga_gain(32);
|
||||
radio::set_baseband_rate(sampling_rate);
|
||||
radio::set_baseband_decimation_by(1);
|
||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
||||
radio::set_direction(rf::Direction::Receive);
|
||||
radio::enable({
|
||||
initial_target_frequency,
|
||||
sampling_rate,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Receive,
|
||||
false, 32, 32,
|
||||
1,
|
||||
});
|
||||
|
||||
BasebandConfigurationMessage message { {
|
||||
.mode = 6,
|
||||
|
@ -169,4 +169,19 @@ void disable() {
|
||||
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 */
|
||||
|
@ -32,6 +32,17 @@
|
||||
|
||||
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 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_antenna_bias(const bool on);
|
||||
|
||||
void enable(Configuration configuration);
|
||||
void configure(Configuration configuration);
|
||||
void disable();
|
||||
|
||||
extern rffc507x::RFFC507x first_if;
|
||||
|
@ -238,14 +238,14 @@ TPMSAppView::TPMSAppView(NavigationView&) {
|
||||
}
|
||||
);
|
||||
|
||||
radio::set_tuning_frequency(tuning_frequency());
|
||||
radio::set_rf_amp(false);
|
||||
radio::set_lna_gain(32);
|
||||
radio::set_vga_gain(32);
|
||||
radio::set_baseband_rate(sampling_rate);
|
||||
radio::set_baseband_decimation_by(1);
|
||||
radio::set_baseband_filter_bandwidth(baseband_bandwidth);
|
||||
radio::set_direction(rf::Direction::Receive);
|
||||
radio::enable({
|
||||
tuning_frequency(),
|
||||
sampling_rate,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Receive,
|
||||
false, 32, 32,
|
||||
1,
|
||||
});
|
||||
|
||||
BasebandConfigurationMessage message { {
|
||||
.mode = 5,
|
||||
|
Loading…
Reference in New Issue
Block a user