From 3096fdac0f7d9884e9accfcee9a06a493155e189 Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Thu, 14 Mar 2024 19:32:11 +0100 Subject: [PATCH] :art: (dac): Add and use interface::DACDMA for DMA usage --- drivers/CoreDAC/include/CoreDAC.h | 6 +++--- include/interface/drivers/DAC.h | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/CoreDAC/include/CoreDAC.h b/drivers/CoreDAC/include/CoreDAC.h index 5b00409bfd..5b41fcced6 100644 --- a/drivers/CoreDAC/include/CoreDAC.h +++ b/drivers/CoreDAC/include/CoreDAC.h @@ -14,7 +14,7 @@ namespace leka { -class CoreDAC : public interface::DACBase +class CoreDAC : public interface::DACDMA { public: CoreDAC(interface::STM32Hal &hal, interface::STM32HalBasicTimer &hal_timer); @@ -24,9 +24,9 @@ class CoreDAC : public interface::DACBase void initialize() final; void terminate() final; - void registerDataToPlay(std::span data); + void registerDataToPlay(std::span data) final; void registerDMACallbacks(std::function const &on_half_transfer, - std::function const &on_complete_transfer); + std::function const &on_complete_transfer) final; void start() final; void stop() final; diff --git a/include/interface/drivers/DAC.h b/include/interface/drivers/DAC.h index a1fdfe2968..6ec3464e49 100644 --- a/include/interface/drivers/DAC.h +++ b/include/interface/drivers/DAC.h @@ -4,6 +4,9 @@ #pragma once +#include +#include + #include "interface/drivers/STM32Hal.h" namespace leka::interface { @@ -22,4 +25,14 @@ class DACBase virtual void stop() = 0; }; +class DACDMA : public DACBase +{ + public: + virtual ~DACDMA() = default; + + virtual void registerDataToPlay(std::span data) = 0; + virtual void registerDMACallbacks(std::function const &on_half_transfer, + std::function const &on_complete_transfer) = 0; +}; + } // namespace leka::interface