2020-09-19 15:44:10 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
struct PWMDriver;
|
|
|
|
|
|
|
|
class Pwm
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Pwm(PWMDriver& driver, uint8_t channel, uint32_t counterFrequency, uint32_t counterPeriod);
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
void SetDuty(float duty);
|
2020-12-15 14:58:39 -08:00
|
|
|
uint16_t GetLastDuty() const;
|
2020-09-19 15:44:10 -07:00
|
|
|
private:
|
|
|
|
PWMDriver* const m_driver;
|
|
|
|
const uint8_t m_channel;
|
|
|
|
const uint32_t m_counterFrequency;
|
|
|
|
const uint16_t m_counterPeriod;
|
2020-12-15 14:58:39 -08:00
|
|
|
uint16_t m_lastDuty;
|
2020-09-19 15:44:10 -07:00
|
|
|
};
|