zynq_7010/zynq_7010_code/Pwm.h

23 lines
408 B
C
Raw Permalink Normal View History

2023-07-17 03:29:37 +00:00
#pragma once
#include <string>
#define PWM_PERIOD 1000000000
class Pwm
{
public:
Pwm(int port);
~Pwm();
void setFreq(int freq);
int getFreq();
void enable(bool bEnable);
bool isEnable();
private:
const std::string path_base = "/sys/class/pwm/pwmchip";
std::string path_enable = "enable";
std::string path_duty_cycle = "duty_cycle";
std::string path_period = "period";
};