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

pwmout_rst_sync_api.h

Committer:
dkato
Date:
2016-09-08
Revision:
3:2ceb3de67371
Parent:
2:2dbc9553463c

File content as of revision 3:2ceb3de67371:

#ifndef PWMOUT_RST_SYNC_API_H
#define PWMOUT_RST_SYNC_API_H

#include "device.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct pwmout_rst_sync_s {
    int pwm_type;
    int pwm_neg_ph;
} pwmout_rst_sync_t;

void pwmout_rst_sync_init         (pwmout_rst_sync_t* obj, PinName pin);
void pwmout_rst_sync_free         (pwmout_rst_sync_t* obj);

void  pwmout_rst_sync_write       (pwmout_rst_sync_t* obj, float percent);
float pwmout_rst_sync_read        (pwmout_rst_sync_t* obj);

void pwmout_rst_sync_period       (float seconds);
void pwmout_rst_sync_period_ms    (int ms);
void pwmout_rst_sync_period_us    (int us);

void pwmout_rst_sync_pulsewidth   (pwmout_rst_sync_t* obj, float seconds);
void pwmout_rst_sync_pulsewidth_ms(pwmout_rst_sync_t* obj, int ms);
void pwmout_rst_sync_pulsewidth_us(pwmout_rst_sync_t* obj, int us);

#ifdef __cplusplus
}
#endif

#endif