mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-10 21:24:12 +01:00
103 lines
3.9 KiB
C
103 lines
3.9 KiB
C
/*
|
|
%atmel_license%
|
|
*/
|
|
|
|
/**
|
|
* \file
|
|
*
|
|
* \par Purpose
|
|
*
|
|
* Interface for configuration the Pulse Width Modulation Controller (PWM) peripheral.
|
|
*
|
|
* \par Usage
|
|
*
|
|
* -# Configures PWM clocks A & B to run at the given frequencies using
|
|
* \ref PWMC_ConfigureClocks().
|
|
* -# Configure PWMC channel using \ref PWMC_ConfigureChannel(), \ref PWMC_ConfigureChannelExt()
|
|
* \ref PWMC_SetPeriod(), \ref PWMC_SetDutyCycle() and \ref PWMC_SetDeadTime().
|
|
* -# Enable & disable channel using \ref PWMC_EnableChannel() and
|
|
* \ref PWMC_DisableChannel().
|
|
* -# Enable & disable the period interrupt for the given PWM channel using
|
|
* \ref PWMC_EnableChannelIt() and \ref PWMC_DisableChannelIt().
|
|
* -# Enable & disable the selected interrupts sources on a PWMC peripheral
|
|
* using \ref PWMC_EnableIt() and \ref PWMC_DisableIt().
|
|
* -# Control syncronous channel using \ref PWMC_ConfigureSyncChannel(),
|
|
* \ref PWMC_SetSyncChannelUpdatePeriod() and \ref PWMC_SetSyncChannelUpdateUnlock().
|
|
* -# Control PWM override output using \ref PWMC_SetOverrideValue(),
|
|
* \ref PWMC_EnableOverrideOutput() and \ref PWMC_DisableOverrideOutput().
|
|
* -# Send data through the transmitter using \ref PWMC_WriteBuffer().
|
|
*
|
|
*/
|
|
|
|
#ifndef _PWMC_
|
|
#define _PWMC_
|
|
|
|
/*----------------------------------------------------------------------------
|
|
* Headers
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
#include "../chip.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*----------------------------------------------------------------------------
|
|
* Exported functions
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
extern void PWMC_ConfigureChannel(
|
|
Pwm* pPwm,
|
|
uint8_t channel,
|
|
uint32_t prescaler,
|
|
uint32_t alignment,
|
|
uint32_t polarity);
|
|
extern void PWMC_ConfigureChannelExt(
|
|
Pwm* pPwm,
|
|
uint8_t channel,
|
|
uint32_t prescaler,
|
|
uint32_t alignment,
|
|
uint32_t polarity,
|
|
uint32_t countEventSelect,
|
|
uint32_t DTEnable,
|
|
uint32_t DTHInverte,
|
|
uint32_t DTLInverte);
|
|
extern void PWMC_ConfigureClocks(uint32_t clka, uint32_t clkb, uint32_t mck);
|
|
extern void PWMC_SetPeriod( Pwm* pPwm, uint8_t channel, uint16_t period);
|
|
extern void PWMC_SetDutyCycle( Pwm* pPwm, uint8_t channel, uint16_t duty);
|
|
extern void PWMC_SetDeadTime( Pwm* pPwm, uint8_t channel, uint16_t timeH, uint16_t timeL);
|
|
extern void PWMC_ConfigureSyncChannel( Pwm* pPwm,
|
|
uint32_t channels,
|
|
uint32_t updateMode,
|
|
uint32_t requestMode,
|
|
uint32_t requestComparisonSelect);
|
|
extern void PWMC_SetSyncChannelUpdatePeriod( Pwm* pPwm, uint8_t period);
|
|
extern void PWMC_SetSyncChannelUpdateUnlock( Pwm* pPwm );
|
|
extern void PWMC_EnableChannel( Pwm* pPwm, uint8_t channel);
|
|
extern void PWMC_DisableChannel( Pwm* pPwm, uint8_t channel);
|
|
extern void PWMC_EnableChannelIt( Pwm* pPwm, uint8_t channel);
|
|
extern void PWMC_DisableChannelIt( Pwm* pPwm, uint8_t channel);
|
|
extern void PWMC_EnableIt( Pwm* pPwm, uint32_t sources1, uint32_t sources2);
|
|
extern void PWMC_DisableIt( Pwm* pPwm, uint32_t sources1, uint32_t sources2);
|
|
extern uint8_t PWMC_WriteBuffer(Pwm *pwmc,
|
|
void *buffer,
|
|
uint32_t length);
|
|
extern void PWMC_SetOverrideValue( Pwm* pPwm, uint32_t value);
|
|
extern void PWMC_EnableOverrideOutput( Pwm* pPwm, uint32_t value, uint32_t sync);
|
|
extern void PWMC_DisableOverrideOutput( Pwm* pPwm, uint32_t value, uint32_t sync);
|
|
extern void PWMC_SetFaultMode( Pwm* pPwm, uint32_t mode);
|
|
extern void PWMC_FaultClear( Pwm* pPwm, uint32_t fault);
|
|
extern void PWMC_SetFaultProtectionValue( Pwm* pPwm, uint32_t value);
|
|
extern void PWMC_EnableFaultProtection( Pwm* pPwm, uint32_t value);
|
|
extern void PWMC_ConfigureComparisonUnit( Pwm* pPwm, uint32_t x, uint32_t value, uint32_t mode);
|
|
extern void PWMC_ConfigureEventLineMode( Pwm* pPwm, uint32_t x, uint32_t mode);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* #ifndef _PWMC_ */
|
|
|