SAMV71 Xplained Ultra Software Package 1.3

pwmc.h

Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2011, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
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, uint32_t sync);
00120 extern void PWMC_OutputOverrideSelection( Pwm* pPwm, uint32_t value );
00121 extern void PWMC_DisableOverrideOutput( Pwm* pPwm, uint32_t value, uint32_t sync);
00122 extern void PWMC_SetFaultMode( Pwm* pPwm, uint32_t mode);
00123 extern void PWMC_FaultClear( Pwm* pPwm, uint32_t fault);
00124 extern void PWMC_SetFaultProtectionValue( Pwm* pPwm, uint32_t value);
00125 extern void PWMC_EnableFaultProtection( Pwm* pPwm, uint32_t value);
00126 extern void PWMC_ConfigureComparisonUnit( Pwm* pPwm, uint32_t x, 
00127     uint32_t value, uint32_t mode);
00128 extern void PWMC_ConfigureEventLineMode( Pwm* pPwm, uint32_t x, uint32_t mode);
00129 extern uint32_t PWMC_GetStatus2( Pwm* pPwm);
00130 #ifdef __cplusplus
00131 }
00132 #endif
00133 
00134 #endif /* #ifndef _PWMC_ */
00135 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines