Skip to content

Commit

Permalink
[sam] Fix SAMx7x DMA LinkedListTransfer copy construction and assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-durand committed Apr 12, 2023
1 parent 182948d commit 94580b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modm/platform/dma/samx7x/transfer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ class LinkedListTransfer : public DmaBase

constexpr LinkedListTransfer();

constexpr LinkedListTransfer(const LinkedListTransfer& other);
constexpr LinkedListTransfer& operator=(const LinkedListTransfer& other);

template<std::size_t index, typename... Ds>
friend auto descriptor(LinkedListTransfer<Ds...>& transfer);

Expand Down
16 changes: 16 additions & 0 deletions src/modm/platform/dma/samx7x/transfer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ constexpr LinkedListTransfer<Descriptors...>::LinkedListTransfer()
detail::SetupList<0, std::tuple<Descriptors...>>::setup(descriptors_);
}

template<typename... Descriptors>
constexpr LinkedListTransfer<Descriptors...>::LinkedListTransfer(const LinkedListTransfer& other)
: descriptors_{other.descriptors_}
{
detail::SetupList<0, std::tuple<Descriptors...>>::setAddress(descriptors_);
}

template<typename... Descriptors>
constexpr LinkedListTransfer<Descriptors...>&
LinkedListTransfer<Descriptors...>::operator=(const LinkedListTransfer& other)
{
descriptors_ = other.descriptors_;
detail::SetupList<0, std::tuple<Descriptors...>>::setAddress(descriptors_);
return *this;
}

template<std::size_t index, typename... Descriptors>
auto descriptor(LinkedListTransfer<Descriptors...>& transfer)
{
Expand Down

0 comments on commit 94580b4

Please sign in to comment.