SAMV71 Xplained Ultra Software Package 1.5

pwmc.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /**
00031  * \file
00032  *
00033  * \par Purpose
00034  *
00035  * Interface for configuration the Pulse Width Modulation Controller (PWM)
00036  * peripheral.
00037  *
00038  * \par Usage
00039  *
00040  *    -# Configures PWM clocks A & B to run at the given frequencies using
00041  *       \ref PWMC_ConfigureClocks().
00042  *    -# Configure PWMC channel using \ref PWMC_ConfigureChannel(),
00043  * \ref PWMC_ConfigureChannelExt()
00044  *       \ref PWMC_SetPeriod(), \ref PWMC_SetDutyCycle() and
00045  * \ref PWMC_SetDeadTime().
00046  *    -# Enable & disable channel using \ref PWMC_EnableChannel() and
00047  *       \ref PWMC_DisableChannel().
00048  *    -# Enable & disable the period interrupt for the given PWM channel using
00049  *       \ref PWMC_EnableChannelIt() and \ref PWMC_DisableChannelIt().
00050  *    -# Enable & disable the selected interrupts sources on a PWMC peripheral
00051  *       using  \ref PWMC_EnableIt() and \ref PWMC_DisableIt().
00052  *    -# Control synchronous channel using \ref PWMC_ConfigureSyncChannel(),
00053  *       \ref PWMC_SetSyncChannelUpdatePeriod() and
00054  * \ref PWMC_SetSyncChannelUpdateUnlock().
00055  *    -# Control PWM override output using \ref PWMC_SetOverrideValue(),
00056  *       \ref PWMC_EnableOverrideOutput() and \ref PWMC_DisableOverrideOutput().
00057  *    -# Send data through the transmitter using \ref PWMC_WriteBuffer().
00058  *
00059  */
00060 
00061 #ifndef _PWMC_
00062 #define _PWMC_
00063 
00064 /*----------------------------------------------------------------------------
00065  *        Headers
00066  *----------------------------------------------------------------------------*/
00067 
00068 #include "chip.h"
00069 
00070 #include <stdint.h>
00071 
00072 #ifdef __cplusplus
00073 extern "C" {
00074 #endif
00075 
00076 /*----------------------------------------------------------------------------
00077  *        Exported functions
00078  *----------------------------------------------------------------------------*/
00079 
00080 extern void PWMC_ConfigureChannel(
00081     Pwm *pPwm,
00082     uint8_t channel,
00083     uint32_t prescaler,
00084     uint32_t alignment,
00085     uint32_t polarity);
00086 extern void PWMC_ConfigureChannelExt(
00087     Pwm *pPwm,
00088     uint8_t channel,
00089     uint32_t prescaler,
00090     uint32_t alignment,
00091     uint32_t polarity,
00092     uint32_t countEventSelect,
00093     uint32_t DTEnable,
00094     uint32_t DTHInverte,
00095     uint32_t DTLInverte);
00096 extern void PWMC_ConfigureClocks(Pwm *pPwm, uint32_t clka, uint32_t clkb,
00097                                  uint32_t mck);
00098 extern void PWMC_SetPeriod(Pwm *pPwm, uint8_t channel, uint16_t period);
00099 extern void PWMC_SetDutyCycle(Pwm *pPwm, uint8_t channel, uint16_t duty);
00100 extern void PWMC_SetDeadTime(Pwm *pPwm, uint8_t channel, uint16_t timeH,
00101                               uint16_t timeL);
00102 extern void PWMC_ConfigureSyncChannel(Pwm *pPwm,
00103                                        uint32_t channels,
00104                                        uint32_t updateMode,
00105                                        uint32_t requestMode,
00106                                        uint32_t requestComparisonSelect);
00107 extern void PWMC_SetSyncChannelUpdatePeriod(Pwm *pPwm, uint8_t period);
00108 extern void PWMC_SetSyncChannelUpdateUnlock(Pwm *pPwm);
00109 extern void PWMC_EnableChannel(Pwm *pPwm, uint8_t channel);
00110 extern void PWMC_DisableChannel(Pwm *pPwm, uint8_t channel);
00111 extern void PWMC_EnableChannelIt(Pwm *pPwm, uint8_t channel);
00112 extern void PWMC_DisableChannelIt(Pwm *pPwm, uint8_t channel);
00113 extern void PWMC_EnableIt(Pwm *pPwm, uint32_t sources1, uint32_t sources2);
00114 extern void PWMC_DisableIt(Pwm *pPwm, uint32_t sources1, uint32_t sources2);
00115 extern uint8_t PWMC_WriteBuffer(Pwm *pwmc,
00116                                 void *buffer,
00117                                 uint32_t length);
00118 extern void PWMC_SetOverrideValue(Pwm *pPwm, uint32_t value);
00119 extern void PWMC_EnableOverrideOutput(Pwm *pPwm, uint32_t value,
00120                                        uint32_t sync);
00121 extern void PWMC_OutputOverrideSelection(Pwm *pPwm, uint32_t value);
00122 extern void PWMC_DisableOverrideOutput(Pwm *pPwm, uint32_t value,
00123                                         uint32_t sync);
00124 extern void PWMC_SetFaultMode(Pwm *pPwm, uint32_t mode);
00125 extern void PWMC_FaultClear(Pwm *pPwm, uint32_t fault);
00126 extern void PWMC_SetFaultProtectionValue(Pwm *pPwm, uint32_t value);
00127 extern void PWMC_EnableFaultProtection(Pwm *pPwm, uint32_t value);
00128 extern void PWMC_ConfigureComparisonUnit(Pwm *pPwm, uint32_t x,
00129         uint32_t value, uint32_t mode);
00130 extern void PWMC_ConfigureEventLineMode(Pwm *pPwm, uint32_t x, uint32_t mode);
00131 extern uint32_t PWMC_GetStatus2(Pwm *pPwm);
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135 
00136 #endif /* #ifndef _PWMC_ */
00137 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines