Aruna
Pwm.h
Go to the documentation of this file.
1 //
2 // Created by noeel on 18-10-20.
3 //
4 
5 #ifndef ARUNA_PWM_H
6 #define ARUNA_PWM_H
7 
8 #include "aruna/arunaTypes.h"
10 
11 namespace aruna {
12  namespace driver {
13  class Pwm: public movement::Actuator {
14  private:
15  uint32_t frequency_hz;
16  uint16_t duty;
17 
18  virtual err_t _set_frequency(uint32_t frequency_hz) = 0;
19 
20  virtual err_t _set_duty(uint16_t duty) = 0;
21 
22  err_t _set(movement::axis_mask_t axisMask, int16_t speed) override;
23 
24  public:
25 
31  err_t set_frequency(uint32_t frequency_hz);
32 
37  uint32_t get_frequency() const;
38 
44  err_t set_duty(float duty_percentage);
45 
51  err_t set_duty(uint16_t duty);
52 
57  float get_duty_per() const;
58 
63  uint16_t get_duty() const;
64 
65  };
66  }
67 }
68 
69 
70 #endif //ARUNA_PWM_H
Definition: comm.cpp:14
virtual err_t _set_duty(uint16_t duty)=0
uint16_t duty
Definition: Pwm.h:16
err_t set_duty(float duty_percentage)
Set the duty cycle on time in percentage.
Definition: Pwm.cpp:23
err_t set_frequency(uint32_t frequency_hz)
Set frequency of PWM in hertz.
Definition: Pwm.cpp:28
err_t _set(movement::axis_mask_t axisMask, int16_t speed) override
Implementation of axis movement, this function is called from set(...).
Definition: Pwm.cpp:44
Link * driver
stores the driver.
Definition: comm.cpp:45
uint16_t get_duty() const
Get the duty cycle on time (16bit)
Definition: Pwm.cpp:11
uint32_t get_frequency() const
Get the frequency used in hertz.
Definition: Pwm.cpp:15
virtual err_t _set_frequency(uint32_t frequency_hz)=0
float get_duty_per() const
Get the duty cycle on time in percentage.
Definition: Pwm.cpp:19
uint32_t frequency_hz
Definition: Pwm.h:15