mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-01 20:39:08 +00:00
Update submodule, fix warnings for PRALINE (#3012)
* update submodule * remove pragma, remove unused variable * fix bad external decl, signed vs unsigned comparison * fix unused: display computed flags * fix max2881 info mess * code format * fix gui positions * use constexpr for min and max lo_frequencies
This commit is contained in:
@@ -38,20 +38,21 @@ using namespace hackrf::one;
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
// Global debug tracking for MAX2831
|
||||
struct max2831_debug_t {
|
||||
uint32_t requested_freq_mhz;
|
||||
uint32_t calculated_n;
|
||||
uint32_t calculated_frac;
|
||||
bool set_frequency_called;
|
||||
bool frequency_valid;
|
||||
};
|
||||
extern "C" max2831_debug_t max2831_debug_info = {0, 0, 0, false, false};
|
||||
|
||||
namespace max2831 {
|
||||
|
||||
using namespace max283x;
|
||||
|
||||
static MAX2831Info max2831_info = {0, 0, 0, false, false};
|
||||
|
||||
MAX2831Info get_max2831_info() {
|
||||
return {
|
||||
max2831_info.requested_freq_mhz,
|
||||
max2831_info.calculated_n,
|
||||
max2831_info.calculated_frac,
|
||||
max2831_info.set_frequency_called,
|
||||
max2831_info.frequency_valid};
|
||||
}
|
||||
|
||||
/*
|
||||
* MAX2831 uses 9-bit SPI transfers.
|
||||
* An 18-bit word is sent as two 9-bit transfers:
|
||||
@@ -378,20 +379,20 @@ bool MAX2831::set_frequency(const rf::Frequency lo_frequency) {
|
||||
*/
|
||||
|
||||
/* MAX2831 supports 2.3-2.6 GHz */
|
||||
// if (lo_frequency < 2300000000ULL || lo_frequency > 2600000000ULL) {
|
||||
// if (lo_frequency < MAX2831_MIN_LO_FREQUENCY_HZ || lo_frequency > MAX2831_MAX_LO_FREQUENCY_HZ) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
bool valid = (lo_frequency >= 2300000000ULL && lo_frequency <= 2600000000ULL);
|
||||
bool valid = (lo_frequency >= MAX2831_MIN_LO_FREQUENCY_HZ && lo_frequency <= MAX2831_MAX_LO_FREQUENCY_HZ);
|
||||
|
||||
// TRACK REQUEST IMMEDIATELY
|
||||
max2831_debug_info.requested_freq_mhz = lo_frequency / 1000000;
|
||||
max2831_debug_info.set_frequency_called = true;
|
||||
max2831_debug_info.frequency_valid = valid;
|
||||
max2831_info.requested_freq_mhz = lo_frequency / 1000000;
|
||||
max2831_info.set_frequency_called = true;
|
||||
max2831_info.frequency_valid = valid;
|
||||
|
||||
if (!valid) {
|
||||
max2831_debug_info.calculated_n = 0;
|
||||
max2831_debug_info.calculated_frac = 0;
|
||||
max2831_info.calculated_n = 0;
|
||||
max2831_info.calculated_frac = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -414,8 +415,8 @@ bool MAX2831::set_frequency(const rf::Frequency lo_frequency) {
|
||||
}
|
||||
|
||||
// TRACK CALCULATED VALUES
|
||||
max2831_debug_info.calculated_n = div_int;
|
||||
max2831_debug_info.calculated_frac = div_frac;
|
||||
max2831_info.calculated_n = div_int;
|
||||
max2831_info.calculated_frac = div_frac;
|
||||
|
||||
/* Write order matters - matches GSG reference */
|
||||
/* REG 3: SYN_INT (bits 7:0) and SYN_FRAC_LO (bits 13:8) */
|
||||
|
||||
Reference in New Issue
Block a user