diff options
Diffstat (limited to 'source/dac.cpp')
-rw-r--r-- | source/dac.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/dac.cpp b/source/dac.cpp index ed08461..283d8a9 100644 --- a/source/dac.cpp +++ b/source/dac.cpp @@ -13,9 +13,9 @@ #include "dac.hpp" DACDriver *DAC::m_driver[2] = { - &DACD1, &DACD2 + &DACD1, nullptr/*&DACD2*/ }; -GPTDriver *DAC::m_timer = &GPTD7; +GPTDriver *DAC::m_timer = nullptr;//&GPTD7; int DAC::m_timer_user_count = 0; const DACConfig DAC::m_config = { @@ -28,11 +28,11 @@ const DACConversionGroup DAC::m_group_config = { .num_channels = 1, .end_cb = nullptr, .error_cb = nullptr, - .trigger = DAC_TRG(2) + .trigger = 5 }; const GPTConfig DAC::m_timer_config = { - .frequency = 36000000, + .frequency = 4800000, .callback = nullptr, .cr2 = TIM_CR2_MMS_1, /* TRGO */ .dier = 0 @@ -44,28 +44,28 @@ void DAC::begin() palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_ANALOG); dacStart(m_driver[0], &m_config); - dacStart(m_driver[1], &m_config); - gptStart(m_timer, &m_timer_config); + //dacStart(m_driver[1], &m_config); + //gptStart(m_timer, &m_timer_config); } void DAC::start(int channel, dacsample_t *buffer, size_t count) { - if (channel >= 0 && channel < 2) { + if (channel >= 0 && channel < 1) { dacStartConversion(m_driver[channel], &m_group_config, buffer, count); - if (m_timer_user_count == 0) - gptStartContinuous(m_timer, ADC::getTimerDivisor()); - m_timer_user_count++; + //if (m_timer_user_count == 0) + // gptStartContinuous(m_timer, ADC::getTimerDivisor()); + //m_timer_user_count++; } } void DAC::stop(int channel) { - if (channel >= 0 && channel < 2) { + if (channel >= 0 && channel < 1) { dacStopConversion(m_driver[channel]); - if (--m_timer_user_count == 0) - gptStopTimer(m_timer); + //if (--m_timer_user_count == 0) + // gptStopTimer(m_timer); } } |