mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-21 12:27:35 +00:00
Improved tone generator for proper frequency control. Also
features a square wave mode. Added proportional beep duration based on the RSSI as well. Now reading the current radiosonde frequency from the battery backed RAM instead starting with the same frequency all the time.
This commit is contained in:
@@ -25,9 +25,6 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <bitset>
|
||||
|
||||
static const std::bitset<2048> wave_bits (0xFFFFFF);
|
||||
|
||||
class ToneGen {
|
||||
public:
|
||||
@@ -38,23 +35,24 @@ public:
|
||||
{};*/
|
||||
|
||||
void configure(const uint32_t delta, const float tone_mix_weight);
|
||||
void configure(const uint32_t delta, const float tone_mix_weight, const tone_type tone_type);
|
||||
void configure(const uint32_t freq, const float tone_mix_weight, const tone_type tone_type, const uint32_t sample_rate);
|
||||
|
||||
int32_t process(const int32_t sample_in);
|
||||
|
||||
private:
|
||||
tone_type current_tone_type_ { sine };
|
||||
|
||||
//size_t sample_rate_;
|
||||
float input_mix_weight_ { 1 };
|
||||
float tone_mix_weight_ { 0 };
|
||||
uint32_t delta_ { 0 };
|
||||
uint32_t tone_phase_ { 0 };
|
||||
|
||||
uint8_t delta_ { 0 };
|
||||
uint8_t tone_phase_ { 0 };
|
||||
|
||||
/**
|
||||
* Generator function for sine waves:
|
||||
* Generator function which selects every other sample from the reference sine waveform to the output sample:
|
||||
*/
|
||||
int32_t tone_from_sine_table();
|
||||
int32_t tone_sine();
|
||||
|
||||
|
||||
/**
|
||||
* Generator function for square waves:
|
||||
|
Reference in New Issue
Block a user