Skip to content

Commit

Permalink
🎨 (dac): Add and use interface::DACDMA for DMA usage
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Mar 14, 2024
1 parent 5eba39b commit 7733657
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/CoreDAC/include/CoreDAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -24,9 +24,9 @@ class CoreDAC : public interface::DACBase
void initialize() final;
void terminate() final;

void registerDataToPlay(std::span<uint16_t> data);
void registerDataToPlay(std::span<uint16_t> data) final;
void registerDMACallbacks(std::function<void()> const &on_half_transfer,
std::function<void()> const &on_complete_transfer);
std::function<void()> const &on_complete_transfer) final;

void start() final;
void stop() final;
Expand Down
13 changes: 13 additions & 0 deletions include/interface/drivers/DAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#pragma once

#include <functional>
#include <span>

#include "interface/drivers/STM32Hal.h"

namespace leka::interface {
Expand All @@ -22,4 +25,14 @@ class DACBase
virtual void stop() = 0;
};

class DACDMA : public DACBase
{
public:
virtual ~DACDMA() = default;

virtual void registerDataToPlay(std::span<uint16_t> data) = 0;
virtual void registerDMACallbacks(std::function<void()> const &on_half_transfer,
std::function<void()> const &on_complete_transfer) = 0;
};

} // namespace leka::interface

0 comments on commit 7733657

Please sign in to comment.