wideband/firmware/pwm.h

27 lines
466 B
C
Raw Normal View History

2020-09-19 15:44:10 -07:00
#pragma once
#include <cstdint>
/* for PWMConfig */
#include "hal.h"
2020-09-19 15:44:10 -07:00
struct PWMDriver;
class Pwm
{
public:
Pwm(PWMDriver& driver);
2020-09-19 15:44:10 -07:00
void Start();
2022-12-01 15:51:01 -08:00
void Start(const PWMConfig& config);
void SetDuty(int channel, float duty);
float GetLastDuty(int channel);
2022-01-26 10:56:58 -08:00
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;
float m_dutyFloat[4];
2020-09-19 15:44:10 -07:00
};