Outputs a PWM signal (3.3V)
More...
#include <PWM.h>
Outputs a PWM signal (3.3V)
- Examples
- example_pwm.cpp, and project_car.cpp.
Definition at line 33 of file PWM.h.
◆ PWM()
PWM::PWM |
( |
uint32_t |
out, |
|
|
double |
frequency, |
|
|
double |
duty_cycle, |
|
|
short |
prescaler = 0b110 |
|
) |
| |
Create PWM signal.
- Parameters
-
out | the pin where the PWM signal will be created (PWM0, PWM1) |
frequency | the frequency of the PWM signal |
duty_cycle | the duty cycle of the signal; for 50%, duty_cycle = 50 |
prescaler | the clock prescaler. Must be a power of 2 between 1 and 64 in bits : 0b001 = 1, 0b010 = 2, 0b011 = 4... |
Definition at line 12 of file PWM.cpp.
◆ ~PWM()
Destructor Desactivate the channel.
Definition at line 132 of file PWM.cpp.
◆ setDutyCycle()
void PWM::setDutyCycle |
( |
double |
dutyCycle | ) |
|
Set the Duty Cycle.
- Parameters
-
dutyCycle | the duty cycle to set |
Definition at line 103 of file PWM.cpp.
◆ setFrequency()
void PWM::setFrequency |
( |
double |
frequency | ) |
|
Set the Frequency Will try to keep the current duty cycle.
- Parameters
-
frequency | the frequency to set |
Definition at line 112 of file PWM.cpp.
◆ setPrescaler()
void PWM::setPrescaler |
( |
short |
clockDiv | ) |
|
Set the clock prescaler Will try to keep the old frequency.
- Parameters
-
clockDiv | the prescaler. Must be 1, 2, 4, 8, 16, 32 or 64 |
Definition at line 124 of file PWM.cpp.
◆ dutyCycle
double myRIO::PWM::dutyCycle |
|
private |
PWM Duty Cycle.
Definition at line 44 of file PWM.h.
◆ frequency
double myRIO::PWM::frequency |
|
private |
PWM Frequency.
Definition at line 45 of file PWM.h.
◆ max
Max value that the PWM counts the counter that generates the PWM signal counts up to the max value to generate the signal that we want.
Definition at line 42 of file PWM.h.
◆ out
Pin PWM.
Definition at line 41 of file PWM.h.
◆ outcmp
uint32_t myRIO::PWM::outcmp |
|
private |
PWM Compare register.
Definition at line 49 of file PWM.h.
◆ outcs
uint32_t myRIO::PWM::outcs |
|
private |
PWM Clock Select register.
Definition at line 47 of file PWM.h.
◆ outmax
uint32_t myRIO::PWM::outmax |
|
private |
PWM Max register.
Definition at line 48 of file PWM.h.
◆ prescaler
uint16_t myRIO::PWM::prescaler |
|
private |
PWM Clock prescaler.
Definition at line 46 of file PWM.h.
The documentation for this class was generated from the following files:
- C:/Users/jackb/OneDrive - etu.univ-lyon1.fr/TERi/Eclipse/workspace/APIForRIO/src/PWM.h
- C:/Users/jackb/OneDrive - etu.univ-lyon1.fr/TERi/Eclipse/workspace/APIForRIO/src/PWM.cpp