#pragma once #include #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"; };