mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-09-18 12:05:00 -04:00
Started adding AFSK modulator options, cleaning up LCR TX
This commit is contained in:
parent
5468917da6
commit
ec26f587f1
9 changed files with 200 additions and 64 deletions
|
@ -55,10 +55,26 @@ using ppb_range_t = range_t<ppb_t>;
|
|||
constexpr ppb_range_t ppb_range { -99000, 99000 };
|
||||
constexpr ppb_t ppb_reset_value { 0 };
|
||||
|
||||
using afsk_freq_range_t = range_t<int16_t>;
|
||||
constexpr afsk_freq_range_t afsk_freq_range { 100, 32000 };
|
||||
constexpr int16_t afsk_mark_reset_value { 1200 };
|
||||
constexpr int16_t afsk_space_reset_value { 2200 };
|
||||
|
||||
using afsk_bitrate_range_t = range_t<int16_t>;
|
||||
constexpr afsk_bitrate_range_t afsk_bitrate_range { 600, 9600 };
|
||||
constexpr int16_t afsk_bitrate_reset_value { 1200 };
|
||||
|
||||
/* struct must pack the same way on M4 and M0 cores. */
|
||||
struct data_t {
|
||||
// General config
|
||||
int64_t tuned_frequency;
|
||||
int32_t correction_ppb;
|
||||
|
||||
// AFSK modem
|
||||
int16_t afsk_mark_freq;
|
||||
int16_t afsk_space_freq;
|
||||
int16_t afsk_bitrate;
|
||||
uint8_t afsk_config;
|
||||
};
|
||||
|
||||
static_assert(sizeof(data_t) <= 0x100, "Persistent memory structure too large for VBAT-maintained region");
|
||||
|
@ -83,5 +99,40 @@ void set_correction_ppb(const ppb_t new_value) {
|
|||
data->correction_ppb = ppb_range.clip(new_value);
|
||||
}
|
||||
|
||||
int16_t afsk_mark_freq() {
|
||||
afsk_freq_range.reset_if_outside(data->afsk_mark_freq, afsk_mark_reset_value);
|
||||
return data->correction_ppb;
|
||||
}
|
||||
|
||||
void set_afsk_mark(const int16_t new_value) {
|
||||
data->afsk_mark_freq = afsk_freq_range.clip(new_value);
|
||||
}
|
||||
|
||||
int16_t afsk_space_freq() {
|
||||
afsk_freq_range.reset_if_outside(data->afsk_space_freq, afsk_space_reset_value);
|
||||
return data->correction_ppb;
|
||||
}
|
||||
|
||||
void set_afsk_space(const int16_t new_value) {
|
||||
data->afsk_space_freq = afsk_freq_range.clip(new_value);
|
||||
}
|
||||
|
||||
int16_t afsk_bitrate() {
|
||||
afsk_bitrate_range.reset_if_outside(data->afsk_bitrate, afsk_bitrate_reset_value);
|
||||
return data->correction_ppb;
|
||||
}
|
||||
|
||||
void set_afsk_bitrate(const int16_t new_value) {
|
||||
data->afsk_bitrate = afsk_bitrate_range.clip(new_value);
|
||||
}
|
||||
|
||||
uint8_t afsk_config() {
|
||||
return data->afsk_config;
|
||||
}
|
||||
|
||||
void set_afsk_config(const uint8_t new_value) {
|
||||
data->afsk_config = new_value;
|
||||
}
|
||||
|
||||
} /* namespace persistent_memory */
|
||||
} /* namespace portapack */
|
||||
|
|
|
@ -37,6 +37,18 @@ void set_tuned_frequency(const rf::Frequency new_value);
|
|||
ppb_t correction_ppb();
|
||||
void set_correction_ppb(const ppb_t new_value);
|
||||
|
||||
int16_t afsk_mark_freq();
|
||||
void set_afsk_mark(const int16_t new_value);
|
||||
|
||||
int16_t afsk_space_freq();
|
||||
void set_afsk_space(const int16_t new_value);
|
||||
|
||||
int16_t afsk_bitrate();
|
||||
void set_afsk_bitrate(const int16_t new_value);
|
||||
|
||||
uint8_t afsk_config();
|
||||
void set_afsk_config(const uint8_t new_value);
|
||||
|
||||
} /* namespace persistent_memory */
|
||||
} /* namespace portapack */
|
||||
|
||||
|
|
|
@ -42,8 +42,11 @@ struct SharedMemory {
|
|||
int test;
|
||||
|
||||
uint32_t rdsdata[16];
|
||||
|
||||
char lcrdata[256];
|
||||
uint32_t fskspb;
|
||||
uint32_t afsk_samples_per_bit;
|
||||
uint32_t afsk_phase_inc_mark;
|
||||
uint32_t afsk_phase_inc_space;
|
||||
};
|
||||
|
||||
extern SharedMemory& shared_memory;
|
||||
|
|
|
@ -63,6 +63,10 @@ struct Color {
|
|||
static constexpr Color red() {
|
||||
return { 255, 0, 0 };
|
||||
}
|
||||
|
||||
static constexpr Color orange() {
|
||||
return { 255, 127, 0 };
|
||||
}
|
||||
|
||||
static constexpr Color yellow() {
|
||||
return { 255, 255, 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue