|
Robobo
|
#include "../chip.h"#include <stdint.h>Go to the source code of this file.
Functions | |
| void | PWMC_ConfigureChannel (Pwm *pPwm, uint32_t ul_channel, uint32_t prescaler, uint32_t alignment, uint32_t polarity) |
| Configures PWM a ul_channel with the given parameters, basic configure function. More... | |
| void | PWMC_ConfigureChannelExt (Pwm *pPwm, uint32_t ul_channel, uint32_t prescaler, uint32_t alignment, uint32_t polarity, uint32_t countEventSelect, uint32_t DTEnable, uint32_t DTHInverte, uint32_t DTLInverte) |
| Configures PWM a ul_channel with the given parameters, extend configure function. More... | |
| void | PWMC_ConfigureClocks (uint32_t clka, uint32_t clkb, uint32_t mck) |
| Configures PWM clocks A & B to run at the given frequencies. More... | |
| void | PWMC_SetPeriod (Pwm *pPwm, uint32_t ul_channel, uint16_t period) |
| Sets the period value used by a PWM ul_channel. More... | |
| void | PWMC_SetDutyCycle (Pwm *pPwm, uint32_t ul_channel, uint16_t duty) |
| Sets the duty cycle used by a PWM ul_channel. This function writes directly to the CDTY register if the ul_channel is disabled; otherwise it uses the update register CDTYUPD. Note that the duty cycle must always be inferior or equal to the ul_channel period. More... | |
| void | PWMC_SetDeadTime (Pwm *pPwm, uint32_t ul_channel, uint16_t timeH, uint16_t timeL) |
| Sets the dead time used by a PWM ul_channel. This function writes directly to the DT register if the ul_channel is disabled; otherwise it uses the update register DTUPD. Note that the dead time must always be inferior or equal to the ul_channel period. More... | |
| void | PWMC_ConfigureSyncChannel (Pwm *pPwm, uint32_t ul_channels, uint32_t updateMode, uint32_t requestMode, uint32_t requestComparisonSelect) |
| Configures Syncronous ul_channel with the given parameters. Beware: At this time, the channels should be disabled. More... | |
| void | PWMC_SetSyncChannelUpdatePeriod (Pwm *pPwm, uint8_t period) |
| Sets the update period of the synchronous channels. This function writes directly to the SCUP register if the ul_channel #0 is disabled; otherwise it uses the update register SCUPUPD. More... | |
| void | PWMC_SetSyncChannelUpdateUnlock (Pwm *pPwm) |
| Sets synchronous channels update unlock. More... | |
| void | PWMC_EnableChannel (Pwm *pPwm, uint32_t ul_channel) |
| Enables the given PWM ul_channel. More... | |
| void | PWMC_DisableChannel (Pwm *pPwm, uint32_t ul_channel) |
| Disables the given PWM ul_channel. More... | |
| void | PWMC_EnableChannelIt (Pwm *pPwm, uint32_t ul_channel) |
| Enables the period interrupt for the given PWM ul_channel. More... | |
| void | PWMC_DisableChannelIt (Pwm *pPwm, uint32_t ul_channel) |
| Disables the period interrupt for the given PWM ul_channel. More... | |
| void | PWMC_EnableIt (Pwm *pPwm, uint32_t sources1, uint32_t sources2) |
| Enables the selected interrupts sources on a PWMC peripheral. More... | |
| void | PWMC_DisableIt (Pwm *pPwm, uint32_t sources1, uint32_t sources2) |
| Disables the selected interrupts sources on a PWMC peripheral. More... | |
| uint8_t | PWMC_WriteBuffer (Pwm *pwmc, void *buffer, uint32_t length) |
| Sends the contents of buffer through a PWMC peripheral, using the PDC to take care of the transfer. More... | |
| void | PWMC_SetOverrideValue (Pwm *pPwm, uint32_t value) |
| Set PWM output override value. More... | |
| void | PWMC_EnableOverrideOutput (Pwm *pPwm, uint32_t value, uint32_t sync) |
| Enalbe override output. More... | |
| void | PWMC_DisableOverrideOutput (Pwm *pPwm, uint32_t value, uint32_t sync) |
| Disalbe override output. More... | |
| void | PWMC_SetFaultMode (Pwm *pPwm, uint32_t mode) |
| Set PWM fault mode. More... | |
| void | PWMC_FaultClear (Pwm *pPwm, uint32_t fault) |
| PWM fault clear. More... | |
| void | PWMC_SetFaultProtectionValue (Pwm *pPwm, uint32_t value) |
| Set PWM fault protection value. More... | |
| void | PWMC_EnableFaultProtection (Pwm *pPwm, uint32_t ul_channel, uint32_t value) |
| Enable PWM fault protection. More... | |
| void | PWMC_ConfigureComparisonUnit (Pwm *pPwm, uint32_t x, uint32_t value, uint32_t mode) |
| Configure comparison unit. More... | |
| void | PWMC_ConfigureEventLineMode (Pwm *pPwm, uint32_t x, uint32_t mode) |
| Configure event line mode. More... | |
Interface for configuration the Pulse Width Modulation Controller (PWM) peripheral.
| void PWMC_ConfigureChannel | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint32_t | prescaler, | ||
| uint32_t | alignment, | ||
| uint32_t | polarity | ||
| ) |
Configures PWM a ul_channel with the given parameters, basic configure function.
The PWM controller must have been clocked in the PMC prior to calling this function. Beware: this function disables the ul_channel. It waits until disable is effective.
| ul_channel | Channel number. |
| prescaler | Channel prescaler. |
| alignment | Channel alignment. |
| polarity | Channel polarity. |
| void PWMC_ConfigureChannelExt | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint32_t | prescaler, | ||
| uint32_t | alignment, | ||
| uint32_t | polarity, | ||
| uint32_t | countEventSelect, | ||
| uint32_t | DTEnable, | ||
| uint32_t | DTHInverte, | ||
| uint32_t | DTLInverte | ||
| ) |
Configures PWM a ul_channel with the given parameters, extend configure function.
The PWM controller must have been clocked in the PMC prior to calling this function. Beware: this function disables the ul_channel. It waits until disable is effective.
| ul_channel | Channel number. |
| prescaler | Channel prescaler. |
| alignment | Channel alignment. |
| polarity | Channel polarity. |
| countEventSelect | Channel counter event selection. |
| DTEnable | Channel dead time generator enable. |
| DTHInverte | Channel Dead-Time PWMHx output Inverted. |
| DTLInverte | Channel Dead-Time PWMHx output Inverted. |
| void PWMC_ConfigureClocks | ( | uint32_t | clka, |
| uint32_t | clkb, | ||
| uint32_t | mck | ||
| ) |
Configures PWM clocks A & B to run at the given frequencies.
This function finds the best MCK divisor and prescaler values automatically.
| clka | Desired clock A frequency (0 if not used). |
| clkb | Desired clock B frequency (0 if not used). |
| mck | Master clock frequency. |
| void PWMC_ConfigureComparisonUnit | ( | Pwm * | pPwm, |
| uint32_t | x, | ||
| uint32_t | value, | ||
| uint32_t | mode | ||
| ) |
Configure comparison unit.
| x | comparison x index |
| value | comparison x value. |
| mode | comparison x mode |
| void PWMC_ConfigureEventLineMode | ( | Pwm * | pPwm, |
| uint32_t | x, | ||
| uint32_t | mode | ||
| ) |
Configure event line mode.
| x | Line x |
| mode | Bitwise OR of line mode selection |
| void PWMC_ConfigureSyncChannel | ( | Pwm * | pPwm, |
| uint32_t | ul_channels, | ||
| uint32_t | updateMode, | ||
| uint32_t | requestMode, | ||
| uint32_t | requestComparisonSelect | ||
| ) |
Configures Syncronous ul_channel with the given parameters. Beware: At this time, the channels should be disabled.
| channels | Bitwise OR of Syncronous channels. |
| updateMode | Syncronous ul_channel update mode. |
| requestMode | PDC transfer request mode. |
| requestComparisonSelect | PDC transfer request comparison selection. |
| void PWMC_DisableChannel | ( | Pwm * | pPwm, |
| uint32_t | ul_channel | ||
| ) |
Disables the given PWM ul_channel.
Beware, ul_channel will be effectively disabled at the end of the current period. Application can check ul_channel is disabled using the following wait loop: while ((PWM->PWM_SR & (1 << ul_channel)) != 0);
| ul_channel | Channel number. |
| void PWMC_DisableChannelIt | ( | Pwm * | pPwm, |
| uint32_t | ul_channel | ||
| ) |
Disables the period interrupt for the given PWM ul_channel.
| ul_channel | Channel number. |
| void PWMC_DisableIt | ( | Pwm * | pPwm, |
| uint32_t | sources1, | ||
| uint32_t | sources2 | ||
| ) |
Disables the selected interrupts sources on a PWMC peripheral.
| sources1 | Bitwise OR of selected interrupt sources of PWM_IDR1. |
| sources2 | Bitwise OR of selected interrupt sources of PWM_IDR2. |
| void PWMC_DisableOverrideOutput | ( | Pwm * | pPwm, |
| uint32_t | value, | ||
| uint32_t | sync | ||
| ) |
Disalbe override output.
| value | Bitwise OR of output selection. |
| sync | 0: enable the output asyncronously, 1: enable it syncronously |
| void PWMC_EnableChannel | ( | Pwm * | pPwm, |
| uint32_t | ul_channel | ||
| ) |
Enables the given PWM ul_channel.
This does NOT enable the corresponding pin;this must be done in the user code.
| ul_channel | Channel number. |
| void PWMC_EnableChannelIt | ( | Pwm * | pPwm, |
| uint32_t | ul_channel | ||
| ) |
Enables the period interrupt for the given PWM ul_channel.
| ul_channel | Channel number. |
| void PWMC_EnableFaultProtection | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint32_t | ul_value | ||
| ) |
Enable PWM fault protection.
| value | Bitwise OR of FPEx[y]. |
| void PWMC_EnableIt | ( | Pwm * | pPwm, |
| uint32_t | sources1, | ||
| uint32_t | sources2 | ||
| ) |
Enables the selected interrupts sources on a PWMC peripheral.
| sources1 | Bitwise OR of selected interrupt sources of PWM_IER1. |
| sources2 | Bitwise OR of selected interrupt sources of PWM_IER2. |
| void PWMC_EnableOverrideOutput | ( | Pwm * | pPwm, |
| uint32_t | value, | ||
| uint32_t | sync | ||
| ) |
Enalbe override output.
| value | Bitwise OR of output selection. |
| sync | 0: enable the output asyncronously, 1: enable it syncronously |
| void PWMC_FaultClear | ( | Pwm * | pPwm, |
| uint32_t | fault | ||
| ) |
PWM fault clear.
| fault | Bitwise OR of fault to clear. |
| void PWMC_SetDeadTime | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint16_t | timeH, | ||
| uint16_t | timeL | ||
| ) |
Sets the dead time used by a PWM ul_channel. This function writes directly to the DT register if the ul_channel is disabled; otherwise it uses the update register DTUPD. Note that the dead time must always be inferior or equal to the ul_channel period.
| ul_channel | Channel number. |
| timeH | Dead time value for PWMHx output. |
| timeL | Dead time value for PWMLx output. |
| void PWMC_SetDutyCycle | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint16_t | duty | ||
| ) |
Sets the duty cycle used by a PWM ul_channel. This function writes directly to the CDTY register if the ul_channel is disabled; otherwise it uses the update register CDTYUPD. Note that the duty cycle must always be inferior or equal to the ul_channel period.
| ul_channel | Channel number. |
| duty | Duty cycle value. |
| void PWMC_SetFaultMode | ( | Pwm * | pPwm, |
| uint32_t | mode | ||
| ) |
Set PWM fault mode.
| mode | Bitwise OR of fault mode. |
| void PWMC_SetFaultProtectionValue | ( | Pwm * | pPwm, |
| uint32_t | value | ||
| ) |
Set PWM fault protection value.
| value | Bitwise OR of fault protection value. |
| void PWMC_SetOverrideValue | ( | Pwm * | pPwm, |
| uint32_t | value | ||
| ) |
Set PWM output override value.
| value | Bitwise OR of output override value. |
| void PWMC_SetPeriod | ( | Pwm * | pPwm, |
| uint32_t | ul_channel, | ||
| uint16_t | period | ||
| ) |
Sets the period value used by a PWM ul_channel.
This function writes directly to the CPRD register if the ul_channel is disabled; otherwise, it uses the update register CPRDUPD.
| ul_channel | Channel number. |
| period | Period value. |
| void PWMC_SetSyncChannelUpdatePeriod | ( | Pwm * | pPwm, |
| uint8_t | period | ||
| ) |
Sets the update period of the synchronous channels. This function writes directly to the SCUP register if the ul_channel #0 is disabled; otherwise it uses the update register SCUPUPD.
| period | update period. |
| void PWMC_SetSyncChannelUpdateUnlock | ( | Pwm * | pPwm | ) |
Sets synchronous channels update unlock.
Note: If the UPDM field is set to 0, writing the UPDULOCK bit to 1 triggers the update of the period value, the duty-cycle and the dead-time values of synchronous channels at the beginning of the next PWM period. If the field UPDM is set to 1 or 2, writing the UPDULOCK bit to 1 triggers only the update of the period value and of the dead-time values of synchronous channels. This bit is automatically reset when the update is done.
| uint8_t PWMC_WriteBuffer | ( | Pwm * | pwmc, |
| void * | pvBuffer, | ||
| uint32_t | length | ||
| ) |
Sends the contents of buffer through a PWMC peripheral, using the PDC to take care of the transfer.
Note: Duty cycle of syncronous channels can update by PDC when the field UPDM (Update Mode) in the PWM_SCM register is set to 2.
| pwmc | Pointer to an Pwm instance. |
| pvBuffer | Data buffer to send. |
| length | Length of the data buffer. |