Improve radio state management re: antenna bias voltage.

Responsibility for radio state is still rather muddy...
This commit is contained in:
Jared Boone 2016-01-23 11:31:50 -08:00
parent 10d4172d5c
commit 25fac90d4f
2 changed files with 8 additions and 1 deletions

View File

@ -120,6 +120,7 @@ uint32_t ReceiverModel::baseband_oversampling() const {
}
void ReceiverModel::enable() {
enabled_ = true;
radio::set_direction(rf::Direction::Receive);
update_tuning_frequency();
update_antenna_bias();
@ -141,7 +142,12 @@ void ReceiverModel::baseband_disable() {
}
void ReceiverModel::disable() {
enabled_ = false;
update_antenna_bias();
baseband_disable();
// TODO: Responsibility for enabling/disabling the radio is muddy.
// Some happens in ReceiverModel, some inside radio namespace.
radio::disable();
}
@ -159,7 +165,7 @@ void ReceiverModel::update_tuning_frequency() {
}
void ReceiverModel::update_antenna_bias() {
radio::set_antenna_bias(antenna_bias_);
radio::set_antenna_bias(antenna_bias_ && enabled_);
}
void ReceiverModel::update_rf_amp() {

View File

@ -89,6 +89,7 @@ public:
private:
rf::Frequency frequency_step_ { 25000 };
bool enabled_ { false };
bool rf_amp_ { false };
bool antenna_bias_ { false };
int32_t lna_gain_db_ { 32 };