The PWM library using the "Reset-Synchronized PWM mode" of "multi-function timer pulse unit 2 (MTU2)".
Dependents: Motor_Control_using_lib Motor_Control_API
PwmOutResetSync
In the reset-synchronized PWM mode, three-phase output of positive PWM waveforms that share a common wave transition point can be obtained by combining channels 3 and 4.
When set for reset-synchronized PWM mode, the TIOC3B, TIOC4A, and TIOC4B pins function as PWM output pins and TCNT3 functions as an upcounter.
RZ/A1H infomation.
Output Pin | Description | Pin to connect to |
---|---|---|
TIOC3B | PWM output pin 1 | P8_11, (P7_9), (P3_5) |
TIOC4A | PWM output pin 2 | P3_8, P4_4, (P7_12), (P11_0) |
TIOC4B | PWM output pin 3 | P3_9, P4_5, (P7_13), (P11_1) |
():On the GR-PEACH, it can not be used.
API
Import library
Public Member Functions |
|
PwmOutResetSync (PinName pin) | |
Create a
PwmOutResetSync
connected to the specified pin.
|
|
virtual | ~PwmOutResetSync () |
Destructor.
|
|
void | write (float value) |
Set the ouput duty-cycle, specified as a percentage (float)
|
|
float | read () |
Return the current output duty-cycle setting, measured as a percentage (float)
|
|
void | pulsewidth (float seconds) |
Set the PWM pulsewidth, specified in seconds (float), keeping the period the same.
|
|
void | pulsewidth_ms (int ms) |
Set the PWM pulsewidth, specified in milli-seconds (int), keeping the period the same.
|
|
void | pulsewidth_us (int us) |
Set the PWM pulsewidth, specified in micro-seconds (int), keeping the period the same.
|
|
PwmOutResetSync & | operator= (float value) |
A operator shorthand for
write()
|
|
operator float () | |
An operator shorthand for
read()
|
|
Static Public Member Functions |
|
static void | period (float seconds) |
Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
|
|
static void | period_ms (int ms) |
Set the PWM period, specified in milli-seconds (int), keeping the duty cycle the same.
|
|
static void | period_us (int us) |
Set the PWM period, specified in micro-seconds (int), keeping the duty cycle the same.
|
Interface
See the Pinout page for more details
Changes
Revision | Date | Who | Commit message |
---|---|---|---|
3:2ceb3de67371 | 2016-09-08 | dkato | Delete the negative-phase waveform output. |
2:2dbc9553463c | 2016-09-02 | dkato | Add negative-phase waveform output. |
1:59fd5b7f58df | 2016-09-01 | dkato | Comments updates. |
0:550ee4ed6462 | 2016-08-31 | dkato | first commit |