[HLT] Add PWM tests that use DMA as the back end (#3447)

Both a decent DMA test, and slightly more reliable PWM test.
This commit is contained in:
Thad House
2021-06-19 01:21:07 -07:00
committed by GitHub
parent 7253edb1e1
commit e7bedde835
3 changed files with 157 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#pragma once
#include <hal/DMA.h>
#include <hal/HAL.h>
namespace hlt {
@@ -27,6 +28,23 @@ struct InterruptHandle {
HAL_InterruptHandle handle = 0;
};
struct DMAHandle {
public:
explicit DMAHandle(int32_t* status) { handle = HAL_InitializeDMA(status); }
DMAHandle(const DMAHandle&) = delete;
DMAHandle operator=(const DMAHandle&) = delete;
DMAHandle(DMAHandle&&) = default;
DMAHandle& operator=(DMAHandle&&) = default;
~DMAHandle() { HAL_FreeDMA(handle); }
operator HAL_DMAHandle() const { return handle; }
private:
HAL_DMAHandle handle = 0;
};
struct DIOHandle {
public:
DIOHandle() {}