mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-29 17:17:28 -04:00
Use receiver/transmitter models everywhere (#1056)
* Use receiver/transmitter models everywhere * Run formatter * Fix a copy-paste bug, make transmitter_model actually set tx_gain. --------- Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
parent
22c9dd31bf
commit
637bcfdbc7
20 changed files with 99 additions and 134 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "max283x.hpp"
|
||||
#include "volume.hpp"
|
||||
|
||||
// TODO: consider a base class for ReceiverModel & TransmitterModel.
|
||||
class ReceiverModel {
|
||||
public:
|
||||
enum class Mode {
|
||||
|
@ -60,8 +61,9 @@ class ReceiverModel {
|
|||
int32_t vga() const;
|
||||
void set_vga(int32_t v_db);
|
||||
|
||||
int32_t tx_gain() const;
|
||||
void set_tx_gain(int32_t v_db);
|
||||
// TODO: Why does receiver need tx_gain?
|
||||
// int32_t tx_gain() const;
|
||||
// void set_tx_gain(int32_t v_db);
|
||||
|
||||
uint32_t sampling_rate() const;
|
||||
void set_sampling_rate(uint32_t v);
|
||||
|
@ -87,7 +89,13 @@ class ReceiverModel {
|
|||
size_t wfm_configuration() const;
|
||||
void set_wfm_configuration(const size_t n);
|
||||
|
||||
void set_configuration_without_init(const Mode new_mode, const rf::Frequency new_frequency_step, const size_t new_am_config_index, const size_t new_nbfm_config_index, const size_t new_wfm_config_index, uint8_t new_squelch_level);
|
||||
void set_configuration_without_init(
|
||||
const Mode new_mode,
|
||||
const rf::Frequency new_frequency_step,
|
||||
const size_t new_am_config_index,
|
||||
const size_t new_nbfm_config_index,
|
||||
const size_t new_wfm_config_index,
|
||||
uint8_t new_squelch_level);
|
||||
|
||||
private:
|
||||
rf::Frequency frequency_step_{25000};
|
||||
|
@ -96,7 +104,7 @@ class ReceiverModel {
|
|||
int32_t lna_gain_db_{32};
|
||||
uint32_t baseband_bandwidth_{max283x::filter::bandwidth_minimum};
|
||||
int32_t vga_gain_db_{32};
|
||||
int32_t tx_gain_db_{47};
|
||||
// int32_t tx_gain_db_{47};
|
||||
Mode mode_{Mode::NarrowbandFMAudio};
|
||||
uint32_t sampling_rate_{3072000};
|
||||
size_t am_config_index = 0;
|
||||
|
@ -113,7 +121,7 @@ class ReceiverModel {
|
|||
void update_lna();
|
||||
void update_baseband_bandwidth();
|
||||
void update_vga();
|
||||
void update_tx_gain();
|
||||
// void update_tx_gain();
|
||||
void update_sampling_rate();
|
||||
void update_headphone_volume();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue