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 PinDescriptionPin to connect to
TIOC3BPWM output pin 1P8_11, (P7_9), (P3_5)
TIOC4APWM output pin 2P3_8, P4_4, (P7_12), (P11_0)
TIOC4BPWM output pin 3P3_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