WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
PWM Output Functions

Functions

HAL_DigitalHandle HAL_InitializePWMPort (int32_t channel, const char *allocationLocation, int32_t *status)
 Initializes a PWM port.
 
void HAL_FreePWMPort (HAL_DigitalHandle pwmPortHandle)
 Frees a PWM port.
 
HAL_Bool HAL_CheckPWMChannel (int32_t channel)
 Checks if a pwm channel is valid.
 
void HAL_SetPWMSimDevice (HAL_DigitalHandle handle, HAL_SimDeviceHandle device)
 Indicates the pwm is used by a simulated device.
 
void HAL_SetPWMPulseTimeMicroseconds (HAL_DigitalHandle pwmPortHandle, int32_t microsecondPulseTime, int32_t *status)
 Sets a PWM channel to the desired pulse width in microseconds.
 
int32_t HAL_GetPWMPulseTimeMicroseconds (HAL_DigitalHandle pwmPortHandle, int32_t *status)
 Gets the current microsecond pulse time from a PWM channel.
 
void HAL_SetPWMOutputPeriod (HAL_DigitalHandle pwmPortHandle, int32_t period, int32_t *status)
 Sets the PWM output period.
 

Detailed Description

Function Documentation

◆ HAL_CheckPWMChannel()

HAL_Bool HAL_CheckPWMChannel ( int32_t channel)

Checks if a pwm channel is valid.

Parameters
channelthe channel to check
Returns
true if the channel is valid, otherwise false

◆ HAL_FreePWMPort()

void HAL_FreePWMPort ( HAL_DigitalHandle pwmPortHandle)

Frees a PWM port.

Parameters
[in]pwmPortHandlethe pwm handle

◆ HAL_GetPWMPulseTimeMicroseconds()

int32_t HAL_GetPWMPulseTimeMicroseconds ( HAL_DigitalHandle pwmPortHandle,
int32_t * status )

Gets the current microsecond pulse time from a PWM channel.

Parameters
[in]pwmPortHandlethe PWM handle
[out]statusError status variable. 0 on success.
Returns
the current PWM microsecond pulse time

◆ HAL_InitializePWMPort()

HAL_DigitalHandle HAL_InitializePWMPort ( int32_t channel,
const char * allocationLocation,
int32_t * status )

Initializes a PWM port.

Parameters
[in]channelthe smartio channel
[in]allocationLocationthe location where the allocation is occurring (can be null)
[out]statusError status variable. 0 on success.
Returns
the created pwm handle

◆ HAL_SetPWMOutputPeriod()

void HAL_SetPWMOutputPeriod ( HAL_DigitalHandle pwmPortHandle,
int32_t period,
int32_t * status )

Sets the PWM output period.

Parameters
[in]pwmPortHandlethe PWM handle.
[in]period0 for 5ms, 1 or 2 for 10ms, 3 for 20ms
[out]statusError status variable. 0 on success.

◆ HAL_SetPWMPulseTimeMicroseconds()

void HAL_SetPWMPulseTimeMicroseconds ( HAL_DigitalHandle pwmPortHandle,
int32_t microsecondPulseTime,
int32_t * status )

Sets a PWM channel to the desired pulse width in microseconds.

Parameters
[in]pwmPortHandlethe PWM handle
[in]microsecondPulseTimethe PWM value to set
[out]statusError status variable. 0 on success.

◆ HAL_SetPWMSimDevice()

void HAL_SetPWMSimDevice ( HAL_DigitalHandle handle,
HAL_SimDeviceHandle device )

Indicates the pwm is used by a simulated device.

Parameters
handlethe pwm handle
devicesimulated device handle