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

Committer:
dkato
Date:
Thu Sep 08 11:05:53 2016 +0000
Revision:
3:2ceb3de67371
Parent:
2:2dbc9553463c
Delete the negative-phase waveform output.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:550ee4ed6462 1 #ifndef PWMOUT_RST_SYNC_API_H
dkato 0:550ee4ed6462 2 #define PWMOUT_RST_SYNC_API_H
dkato 0:550ee4ed6462 3
dkato 0:550ee4ed6462 4 #include "device.h"
dkato 0:550ee4ed6462 5
dkato 0:550ee4ed6462 6 #ifdef __cplusplus
dkato 0:550ee4ed6462 7 extern "C" {
dkato 0:550ee4ed6462 8 #endif
dkato 0:550ee4ed6462 9
dkato 0:550ee4ed6462 10 typedef struct pwmout_rst_sync_s {
dkato 2:2dbc9553463c 11 int pwm_type;
dkato 2:2dbc9553463c 12 int pwm_neg_ph;
dkato 0:550ee4ed6462 13 } pwmout_rst_sync_t;
dkato 0:550ee4ed6462 14
dkato 3:2ceb3de67371 15 void pwmout_rst_sync_init (pwmout_rst_sync_t* obj, PinName pin);
dkato 0:550ee4ed6462 16 void pwmout_rst_sync_free (pwmout_rst_sync_t* obj);
dkato 0:550ee4ed6462 17
dkato 0:550ee4ed6462 18 void pwmout_rst_sync_write (pwmout_rst_sync_t* obj, float percent);
dkato 0:550ee4ed6462 19 float pwmout_rst_sync_read (pwmout_rst_sync_t* obj);
dkato 0:550ee4ed6462 20
dkato 0:550ee4ed6462 21 void pwmout_rst_sync_period (float seconds);
dkato 0:550ee4ed6462 22 void pwmout_rst_sync_period_ms (int ms);
dkato 0:550ee4ed6462 23 void pwmout_rst_sync_period_us (int us);
dkato 0:550ee4ed6462 24
dkato 0:550ee4ed6462 25 void pwmout_rst_sync_pulsewidth (pwmout_rst_sync_t* obj, float seconds);
dkato 0:550ee4ed6462 26 void pwmout_rst_sync_pulsewidth_ms(pwmout_rst_sync_t* obj, int ms);
dkato 0:550ee4ed6462 27 void pwmout_rst_sync_pulsewidth_us(pwmout_rst_sync_t* obj, int us);
dkato 0:550ee4ed6462 28
dkato 0:550ee4ed6462 29 #ifdef __cplusplus
dkato 0:550ee4ed6462 30 }
dkato 0:550ee4ed6462 31 #endif
dkato 0:550ee4ed6462 32
dkato 0:550ee4ed6462 33 #endif
dkato 0:550ee4ed6462 34
dkato 3:2ceb3de67371 35