mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-17 13:14:18 -05:00
RF antenna bias voltage control API.
This commit is contained in:
parent
02b3e891f7
commit
10d4172d5c
@ -152,7 +152,13 @@ void set_baseband_decimation_by(const size_t n) {
|
|||||||
baseband_cpld.set_decimation_by(n);
|
baseband_cpld.set_decimation_by(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_antenna_bias(const bool on) {
|
||||||
|
/* Pull MOSFET gate low to turn on antenna bias. */
|
||||||
|
first_if.set_gpo1(on ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
void disable() {
|
void disable() {
|
||||||
|
set_antenna_bias(false);
|
||||||
baseband_codec.set_mode(max5864::Mode::Shutdown);
|
baseband_codec.set_mode(max5864::Mode::Shutdown);
|
||||||
second_if.set_mode(max2837::Mode::Standby);
|
second_if.set_mode(max2837::Mode::Standby);
|
||||||
first_if.disable();
|
first_if.disable();
|
||||||
|
@ -42,6 +42,7 @@ void set_vga_gain(const int_fast8_t db);
|
|||||||
void set_sampling_frequency(const uint32_t frequency);
|
void set_sampling_frequency(const uint32_t frequency);
|
||||||
void set_baseband_filter_bandwidth(const uint32_t bandwidth_minimum);
|
void set_baseband_filter_bandwidth(const uint32_t bandwidth_minimum);
|
||||||
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 disable();
|
void disable();
|
||||||
|
|
||||||
|
@ -52,6 +52,15 @@ void ReceiverModel::set_reference_ppm_correction(int32_t v) {
|
|||||||
clock_manager.set_reference_ppb(v * 1000);
|
clock_manager.set_reference_ppb(v * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ReceiverModel::antenna_bias() const {
|
||||||
|
return antenna_bias_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReceiverModel::set_antenna_bias(bool enabled) {
|
||||||
|
antenna_bias_ = enabled;
|
||||||
|
update_antenna_bias();
|
||||||
|
}
|
||||||
|
|
||||||
bool ReceiverModel::rf_amp() const {
|
bool ReceiverModel::rf_amp() const {
|
||||||
return rf_amp_;
|
return rf_amp_;
|
||||||
}
|
}
|
||||||
@ -113,6 +122,7 @@ uint32_t ReceiverModel::baseband_oversampling() const {
|
|||||||
void ReceiverModel::enable() {
|
void ReceiverModel::enable() {
|
||||||
radio::set_direction(rf::Direction::Receive);
|
radio::set_direction(rf::Direction::Receive);
|
||||||
update_tuning_frequency();
|
update_tuning_frequency();
|
||||||
|
update_antenna_bias();
|
||||||
update_rf_amp();
|
update_rf_amp();
|
||||||
update_lna();
|
update_lna();
|
||||||
update_vga();
|
update_vga();
|
||||||
@ -148,6 +158,10 @@ void ReceiverModel::update_tuning_frequency() {
|
|||||||
radio::set_tuning_frequency(persistent_memory::tuned_frequency() + tuning_offset());
|
radio::set_tuning_frequency(persistent_memory::tuned_frequency() + tuning_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReceiverModel::update_antenna_bias() {
|
||||||
|
radio::set_antenna_bias(antenna_bias_);
|
||||||
|
}
|
||||||
|
|
||||||
void ReceiverModel::update_rf_amp() {
|
void ReceiverModel::update_rf_amp() {
|
||||||
radio::set_rf_amp(rf_amp_);
|
radio::set_rf_amp(rf_amp_);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ public:
|
|||||||
int32_t reference_ppm_correction() const;
|
int32_t reference_ppm_correction() const;
|
||||||
void set_reference_ppm_correction(int32_t v);
|
void set_reference_ppm_correction(int32_t v);
|
||||||
|
|
||||||
|
bool antenna_bias() const;
|
||||||
|
void set_antenna_bias(bool enabled);
|
||||||
|
|
||||||
bool rf_amp() const;
|
bool rf_amp() const;
|
||||||
void set_rf_amp(bool enabled);
|
void set_rf_amp(bool enabled);
|
||||||
|
|
||||||
@ -87,6 +90,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
rf::Frequency frequency_step_ { 25000 };
|
rf::Frequency frequency_step_ { 25000 };
|
||||||
bool rf_amp_ { false };
|
bool rf_amp_ { false };
|
||||||
|
bool antenna_bias_ { false };
|
||||||
int32_t lna_gain_db_ { 32 };
|
int32_t lna_gain_db_ { 32 };
|
||||||
uint32_t baseband_bandwidth_ { max2837::filter::bandwidth_minimum };
|
uint32_t baseband_bandwidth_ { max2837::filter::bandwidth_minimum };
|
||||||
int32_t vga_gain_db_ { 32 };
|
int32_t vga_gain_db_ { 32 };
|
||||||
@ -101,6 +105,7 @@ private:
|
|||||||
int32_t tuning_offset();
|
int32_t tuning_offset();
|
||||||
|
|
||||||
void update_tuning_frequency();
|
void update_tuning_frequency();
|
||||||
|
void update_antenna_bias();
|
||||||
void update_rf_amp();
|
void update_rf_amp();
|
||||||
void update_lna();
|
void update_lna();
|
||||||
void update_baseband_bandwidth();
|
void update_baseband_bandwidth();
|
||||||
|
@ -262,6 +262,18 @@ void RFFC507x::set_frequency(const rf::Frequency lo_frequency) {
|
|||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RFFC507x::set_gpo1(const bool new_value) {
|
||||||
|
if( new_value ) {
|
||||||
|
_map.r.gpo.p2gpo |= 1;
|
||||||
|
_map.r.gpo.p1gpo |= 1;
|
||||||
|
} else {
|
||||||
|
_map.r.gpo.p2gpo &= ~1;
|
||||||
|
_map.r.gpo.p1gpo &= ~1;
|
||||||
|
}
|
||||||
|
|
||||||
|
flush_one(Register::GPO);
|
||||||
|
}
|
||||||
|
|
||||||
spi::reg_t RFFC507x::readback(const Readback readback) {
|
spi::reg_t RFFC507x::readback(const Readback readback) {
|
||||||
/* TODO: This clobbers the rest of the DEV_CTRL register
|
/* TODO: This clobbers the rest of the DEV_CTRL register
|
||||||
* Time to implement bitfields for registers.
|
* Time to implement bitfields for registers.
|
||||||
|
@ -808,6 +808,7 @@ public:
|
|||||||
|
|
||||||
void set_mixer_current(const uint8_t value);
|
void set_mixer_current(const uint8_t value);
|
||||||
void set_frequency(const rf::Frequency lo_frequency);
|
void set_frequency(const rf::Frequency lo_frequency);
|
||||||
|
void set_gpo1(const bool new_value);
|
||||||
|
|
||||||
reg_t read(const address_t reg_num);
|
reg_t read(const address_t reg_num);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user