FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
PWM HAL APIs

Data Structures

struct  IotPwmConfig_t
 PWM configuration type. More...
 

Macros

#define IOT_PWM_SUCCESS   ( 0 )
 Return values used by PWM driver. More...
 
#define IOT_PWM_INVALID_VALUE   ( 1 )
 
#define IOT_PWM_NOT_CONFIGURED   ( 2 )
 
#define IOT_PWM_FUNCTION_NOT_SUPPORTED   ( 3 )
 

Typedefs

typedef struct IotPwmDescriptor * IotPwmHandle_t
 IotPwmHandle_t type is the PWM handle returned by calling iot_pwm_open() this is initialized in open and returned to caller. Caller must pass this pointer to the rest of the APIs.
 

Functions

IotPwmHandle_t iot_pwm_open (int32_t lPwmInstance)
 iot_pwm_open is used to initialize the PWM driver instance. this API will configure PWM and may reset the PWM hardware. More...
 
int32_t iot_pwm_set_config (IotPwmHandle_t const pxPwmHandle, const IotPwmConfig_t xConfig)
 iot_pwm_set_config sets up the PWM frequency and duty cycle to generate the PWM pulses required. More...
 
IotPwmConfig_tiot_pwm_get_config (IotPwmHandle_t const pxPwmHandle)
 iot_pwm_get_config returns the current PWM configuration More...
 
int32_t iot_pwm_start (IotPwmHandle_t const pxPwmHandle)
 Start the PWM hardware. PWM configuration must be set before PWM is started. PWM signal availability on the configured output based on the PWMChannel configured in iot_pwm_set_config(). More...
 
int32_t iot_pwm_stop (IotPwmHandle_t const pxPwmHandle)
 Stop the PWM hardware. More...
 
int32_t iot_pwm_close (IotPwmHandle_t const pxPwmHandle)
 iot_pwm_close de-initializes the PWM. More...
 

Detailed Description

Macro Definition Documentation

◆ IOT_PWM_SUCCESS

#define IOT_PWM_SUCCESS   ( 0 )

Return values used by PWM driver.

PWM operation completed successfully.

◆ IOT_PWM_INVALID_VALUE

#define IOT_PWM_INVALID_VALUE   ( 1 )

At least one parameter is invalid.

◆ IOT_PWM_NOT_CONFIGURED

#define IOT_PWM_NOT_CONFIGURED   ( 2 )

PWM must be configured prior to start.

◆ IOT_PWM_FUNCTION_NOT_SUPPORTED

#define IOT_PWM_FUNCTION_NOT_SUPPORTED   ( 3 )

PWM operation not supported.

Function Documentation

◆ iot_pwm_open()

IotPwmHandle_t iot_pwm_open ( int32_t  lPwmInstance)

iot_pwm_open is used to initialize the PWM driver instance. this API will configure PWM and may reset the PWM hardware.

Parameters
[in]lPwmInstanceThe instance of the PWM to initialize. PWM is output only.
Returns
  • Handle to PWM interface on success
  • NULL if
    • invalid instance
    • instance already open

◆ iot_pwm_set_config()

int32_t iot_pwm_set_config ( IotPwmHandle_t const  pxPwmHandle,
const IotPwmConfig_t  xConfig 
)

iot_pwm_set_config sets up the PWM frequency and duty cycle to generate the PWM pulses required.

Parameters
[in]pxPwmHandleHandle to PWM driver returned in iot_pwm_open
[in]xConfigPWM configuration to be setup.
Returns
  • IOT_PWM_SUCCESS on success
  • IOT_PWM_INVALID_VALUE if pxPwmHandle == NULL or invalid config setting

◆ iot_pwm_get_config()

IotPwmConfig_t* iot_pwm_get_config ( IotPwmHandle_t const  pxPwmHandle)

iot_pwm_get_config returns the current PWM configuration

Parameters
[in]pxPwmHandleHandle to PWM driver returned in iot_pwm_open
Returns
  • pointer to current PWM configuration on success
  • NULL if pxPwmHandle == NULL

◆ iot_pwm_start()

int32_t iot_pwm_start ( IotPwmHandle_t const  pxPwmHandle)

Start the PWM hardware. PWM configuration must be set before PWM is started. PWM signal availability on the configured output based on the PWMChannel configured in iot_pwm_set_config().

Parameters
[in]pxPwmHandleHandle to PWM driver returned in iot_pwm_open
Returns
  • IOT_PWM_SUCCESS on success
  • IOT_PWM_INVALID_VALUE if pxPwmHandle == NULL
  • IOT_PWM_NOT_CONFIGURED if iot_pwm_set_config hasn't been called.

◆ iot_pwm_stop()

int32_t iot_pwm_stop ( IotPwmHandle_t const  pxPwmHandle)

Stop the PWM hardware.

Parameters
[in]pxPwmHandleHandle to PWM driver returned in iot_pwm_open
Returns
  • IOT_PWM_SUCCESS on success
  • IOT_PWM_INVALID_VALUE if pxPwmHandle == NULL

◆ iot_pwm_close()

int32_t iot_pwm_close ( IotPwmHandle_t const  pxPwmHandle)

iot_pwm_close de-initializes the PWM.

Parameters
[in]pxPwmHandleHandle to PWM driver returned in iot_pwm_open
Returns
  • IOT_PWM_SUCCESS on success
  • IOT_PWM_INVALID_VALUE if
    • pxPwmHandle == NULL
    • not in open state (already closed).