[HLT] Implement duty cycle cross connect tests (#3453)

This commit is contained in:
Thad House
2021-06-19 20:11:52 -07:00
committed by GitHub
parent ee6377e54b
commit 29ae8640d9
2 changed files with 72 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
#pragma once
#include <hal/DMA.h>
#include <hal/DutyCycle.h>
#include <hal/HAL.h>
namespace hlt {
@@ -105,6 +106,26 @@ struct AnalogTriggerHandle {
HAL_AnalogTriggerHandle handle = 0;
};
struct DutyCycleHandle {
public:
DutyCycleHandle(HAL_DigitalHandle port, int32_t* status) {
handle = HAL_InitializeDutyCycle(
port, HAL_AnalogTriggerType::HAL_Trigger_kInWindow, status);
}
DutyCycleHandle(const DutyCycleHandle&) = delete;
DutyCycleHandle operator=(const DutyCycleHandle&) = delete;
DutyCycleHandle(DutyCycleHandle&&) = default;
DutyCycleHandle& operator=(DutyCycleHandle&&) = default;
~DutyCycleHandle() { HAL_FreeDutyCycle(handle); }
operator HAL_DutyCycleHandle() const { return handle; }
private:
HAL_DutyCycleHandle handle = 0;
};
struct DIOHandle {
public:
DIOHandle() {}