AIROC™ BTSDK v4.9 - Documentation | ||||
Macros | |
#define | pwmIdToMask(id) (1<<id) |
Defines the standard PWM driver. More... | |
Enumerations | |
enum | { PWM0 = 0, PWM1 = 1, PWM2 = 2, PWM3 = 3, MAX_PWMS = 4 } |
PWM HW block has 4 PWM channels each with its own 10 bit counter. More... | |
enum | PwmClockType { LHL_CLK, PMU_CLK } |
Clock used for PWM. When LHL_CLK is set, 128 KHz is used. When PMU_CLK is set, 1 MHz or 8 MHz. More... | |
enum | { PWM_CHANNEL_MASK = 0x0F } |
enum | { PWM0_OUTPUT_ENABLE_P26 = GPIO_OUTPUT_ENABLE, PWM1_OUTPUT_ENABLE_P27 = GPIO_OUTPUT_ENABLE, PWM2_OUTPUT_ENABLE_P28 = GPIO_OUTPUT_ENABLE, PWM2_OUTPUT_ENABLE_P6 = (GPIO_OUTPUT_ENABLE | (1 << 4)), PWM2_OUTPUT_ENABLE_P14 = (2 << 4), PWM3_OUTPUT_ENABLE_P29 = GPIO_OUTPUT_ENABLE, PWM3_OUTPUT_ENABLE_P13 = (2 << 4) } |
Functions | |
BOOL32 | pwm_start (UINT8 id, PwmClockType clk, UINT32 toggleCount, UINT32 InitCount) |
Start a PWM. More... | |
BOOL32 | pwm_transitionToSubstituteValues (UINT8 id, UINT32 toggleCount, UINT32 InitCount) |
Transitions to another set of pulse modulation values. More... | |
BOOL32 | pwm_startWithAlternateValues (UINT8 id, PwmClockType clk, UINT32 toggleCount, UINT32 InitCount, BOOL32 invert) |
Alternate between another set of pulse modulation values and current values. More... | |
UINT32 | pwm_getToggleCount (UINT8 id) |
Get the toggleCount of the PWM channel. More... | |
UINT32 | pwm_getInitValue (UINT8 id) |
Get the Init Value of the PWM channel. More... | |
BOOL32 | pwm_setToggleCount (UINT8 id, UINT32 toggleCount) |
Set toggleCount. More... | |
void | pwm_setInversion (UINT8 id, BOOL32 invert) |
Set if output should be inverted or not. More... | |
BOOL32 | pwm_setValues (UINT8 id, UINT32 toggleCount, UINT32 initCount, PwmClockType clk, BOOL32 invert) |
Set the values of the given PWM channel. More... | |
void | pwm_setClock (UINT8 id, PwmClockType clk) |
Set the clock. More... | |
void | pwm_setInitValue (UINT8 id, UINT32 InitCount) |
Set the Initial Value of the Counter. More... | |
void | pwm_resetInternalCount (UINT32 mask) |
Reset the internal counter. Internal, not for application use. | |
void | pwm_enableChannel (UINT32 mask) |
Enable the given PWM channels. More... | |
void | pwm_disableChannel (UINT32 mask) |
Disable the given PWM channels. More... | |
void | pwm_setReset (UINT32 mask, BOOL32 resetEnable) |
Reset the PWM channels. More... | |
#define pwmIdToMask | ( | id | ) | (1<<id) |
Defines the standard PWM driver.
The PWM uses the ACLK as a reference clock and the counts are incremented at the ACLK edges starting at init value. When the count reaches toggle value, the PWM channel output is inverted and when the count reaches 0x3FF, the output is inverted again and the count wraps around to init value and so on. When a 50% duty cycle is called for, ensure that init value is the same distance from toggle value as toggle value is from 0x3FF.
The 4 PWM channels are output to GPIOs P26, P27, P28 and P29. Once the PWM is configured, the corresponding GPIO must also be output enabled using gpio_configurePin.PWM HW block has 4 PWMs Channels(10 bit) This macros enable to switch from Pwm to its mask value. These mask values are used in enable/disable case.
anonymous enum |
PWM HW block has 4 PWM channels each with its own 10 bit counter.
The first PWM id is PWM0;
anonymous enum |
enum PwmClockType |
Clock used for PWM. When LHL_CLK is set, 128 KHz is used. When PMU_CLK is set, 1 MHz or 8 MHz.
void pwm_disableChannel | ( | UINT32 | mask | ) |
Disable the given PWM channels.
mask | - the PWD channels to disable. |
void pwm_enableChannel | ( | UINT32 | mask | ) |
Enable the given PWM channels.
mask | - the PWD channels to enable. |
UINT32 pwm_getInitValue | ( | UINT8 | id | ) |
Get the Init Value of the PWM channel.
id | - the PWD channel. |
UINT32 pwm_getToggleCount | ( | UINT8 | id | ) |
Get the toggleCount of the PWM channel.
id | - the PWM channel. |
void pwm_setClock | ( | UINT8 | id, |
PwmClockType | clk | ||
) |
Set the clock.
id | - the PWD channel. |
clk | - which clockspeed to use. |
void pwm_setInitValue | ( | UINT8 | id, |
UINT32 | InitCount | ||
) |
Set the Initial Value of the Counter.
id | - the PWD channel. |
InitCount | - The initial count to use for the given channel. |
void pwm_setInversion | ( | UINT8 | id, |
BOOL32 | invert | ||
) |
Set if output should be inverted or not.
This is not glitch free.
id | - the PWD channel. |
invert | Whether to invert the output or not. When TRUE, output will be inverted. |
void pwm_setReset | ( | UINT32 | mask, |
BOOL32 | resetEnable | ||
) |
Reset the PWM channels.
mask | - the PWD channels to enable/disable. |
resetEnable | - When TRUE, channels will be disabled, when FALSE, channels will be enabled. |
BOOL32 pwm_setToggleCount | ( | UINT8 | id, |
UINT32 | toggleCount | ||
) |
Set toggleCount.
Not glitch free.
id | - the PWD channel. |
toggleCount | - value on which a toggle happens. |
BOOL32 pwm_setValues | ( | UINT8 | id, |
UINT32 | toggleCount, | ||
UINT32 | initCount, | ||
PwmClockType | clk, | ||
BOOL32 | invert | ||
) |
Set the values of the given PWM channel.
id | - the PWD channel. |
toggleCount | - value on which a toggle happens. |
InitCount | - initial value for the counter. |
clk | - which clockspeed to use. |
invert | - if invert bit is on. |
BOOL32 pwm_start | ( | UINT8 | id, |
PwmClockType | clk, | ||
UINT32 | toggleCount, | ||
UINT32 | InitCount | ||
) |
Start a PWM.
id | - the PWD channel. |
clk | - which clockspeed to use. |
toggleCount | - value on which a toggle happens. |
InitCount | - initial value for the counter. |
BOOL32 pwm_startWithAlternateValues | ( | UINT8 | id, |
PwmClockType | clk, | ||
UINT32 | toggleCount, | ||
UINT32 | InitCount, | ||
BOOL32 | invert | ||
) |
Alternate between another set of pulse modulation values and current values.
id | - the PWD channel. |
clk | - which clockspeed to use. |
toggleCount | - value on which a toggle happens. |
phaseCount | - initial value for the counter. |
invert | - whether to invert the signal. |
BOOL32 pwm_transitionToSubstituteValues | ( | UINT8 | id, |
UINT32 | toggleCount, | ||
UINT32 | InitCount | ||
) |
Transitions to another set of pulse modulation values.
id | - the PWD channel. |
toggleCount | - value on which a toggle happens. |
InitCount | - initial value for the counter. |