代码拉取完成,页面将自动刷新
#ifndef ARDUINO_ANALOG_WAVE
#define ARDUINO_ANALOG_WAVE
#include "FspTimer.h"
#include "r_dtc.h"
#define SAMPLES_FOR_PREDEFINED_WAVE 24
#define WAVE_PRIORITY 1
#define WAVE_BUFFER_SIZE 1000
class analogWaveRev {
private:
FspTimer timer;
volatile uint32_t pin;
uint16_t *buffer;
uint8_t dac_bits;
uint8_t *samples8;
uint16_t *samples16;
uint32_t size;
volatile uint32_t index;
volatile float _amplitude;
volatile uint32_t _offset;
uint16_t freq1, freq2;
float delta_w1, delta_w2;
float w1 = 0, w2 = 0;
uint16_t wave_buffer[2][WAVE_BUFFER_SIZE];
int current_wave = 0;
uint16_t sample_rate;
double freq_max;
double dac_max_samp_rate;
dtc_instance_ctrl_t dtc_ctrl;
transfer_info_t dtc_info;
dtc_extended_cfg_t dtc_cfg_extend;
transfer_cfg_t dtc_cfg;
void init(pin_size_t p);
/* update the output with the next sample value */
// bool update();
void calc_wave(uint16_t *buf);
public:
/* constructor 1 with only DAC pin (to be used when predefined waveform are used) */
analogWaveRev(pin_size_t pinNumber);
/* constructor 2 with buffer to be used (sample in buffer are output ciclycally */
analogWaveRev(pin_size_t pinNumber, uint16_t *_buffer, uint32_t _size, uint32_t _offset);
bool begin(uint16_t _sample_rate);
/* updated the frequency used */
bool freq(uint16_t _freq1_hz, uint16_t _freq2_hz);
/* start the generation of sample */
void start();
/* stop the genration of sample */
void stop();
// void _pre_sync();
// void sine(float freq_hz);
void switch_buffer();
};
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。