Driver to output a PWM on a supported serial device. More...
#include <pwm_driver.h>
Public Member Functions | |
uint8_t | getDeviceAddress (void) |
bool | initialize () |
Initializes the driver and the connected hardware. | |
PwmDriver (bosch_hardware_interface *hw, uint32_t frequency, uint8_t pin) | |
Constructor: | |
bool | set (float value) |
Sends the duty cycle value to a supported serial device. | |
~PwmDriver () | |
Private Attributes | |
uint32_t | _frequency |
uint8_t | _pin |
Driver to output a PWM on a supported serial device.
This class lets the user access the PWM pins of any supported hardware to apply a PWM to supported hardware passing the duty cycle in as a value between 0 (constant low) and 1 (constant high)
Definition at line 57 of file pwm_driver.h.
PwmDriver::PwmDriver | ( | bosch_hardware_interface * | hw, |
uint32_t | frequency, | ||
uint8_t | pin | ||
) |
Constructor:
frequency | PWM frequency |
pin | pin number on the hardware device to apply the PWM to |
Definition at line 41 of file pwm_driver.cpp.
Definition at line 47 of file pwm_driver.cpp.
uint8_t PwmDriver::getDeviceAddress | ( | void | ) | [virtual] |
Implements bosch_drivers_common::sensor_driver.
Definition at line 51 of file pwm_driver.cpp.
bool PwmDriver::initialize | ( | ) |
Initializes the driver and the connected hardware.
Definition at line 57 of file pwm_driver.cpp.
bool PwmDriver::set | ( | float | value | ) |
Sends the duty cycle value to a supported serial device.
value | duty cycle as fraction [0..1] with 0 being constant LOW and 1 being constant HIGH |
Definition at line 68 of file pwm_driver.cpp.
uint32_t PwmDriver::_frequency [private] |
Definition at line 89 of file pwm_driver.h.
uint8_t PwmDriver::_pin [private] |
Definition at line 90 of file pwm_driver.h.