Tizen Native API
7.0
|
The PWM API provides functions to control PWM peripherals connected to the IoT device.
Required Header
#include <peripheral_io.h>
Overview
This PWM API provides functions to control PWM peripherals connected to the IoT device.
Realted Features
This API is related with the following feature:
It is recommended to use features in your application for reliability.
You can check if a IoT device supports the related features for this API
by using System Information, and control your application's actions accordingly.
To ensure your application is only running on the IoT device with specific features,
please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | peripheral_pwm_open (int chip, int pin, peripheral_pwm_h *pwm) |
Opens the PWM pin. | |
int | peripheral_pwm_close (peripheral_pwm_h pwm) |
Closes the PWM pin. | |
int | peripheral_pwm_set_period (peripheral_pwm_h pwm, uint32_t period_ns) |
Sets period of the PWM pin. | |
int | peripheral_pwm_set_duty_cycle (peripheral_pwm_h pwm, uint32_t duty_cycle_ns) |
Sets duty cycle of the PWM pin. | |
int | peripheral_pwm_set_polarity (peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity) |
Sets polarity of the PWM pin. | |
int | peripheral_pwm_set_enabled (peripheral_pwm_h pwm, bool enabled) |
Enables the PWM pin. | |
Typedefs | |
typedef struct _peripheral_pwm_s * | peripheral_pwm_h |
The handle of the PWM peripherals. |
Typedef Documentation
typedef struct _peripheral_pwm_s* peripheral_pwm_h |
The handle of the PWM peripherals.
- Since :
- 4.0
Enumeration Type Documentation
Function Documentation
int peripheral_pwm_close | ( | peripheral_pwm_h | pwm | ) |
Closes the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] pwm The PWM handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
- Precondition:
- peripheral_pwm_open()
int peripheral_pwm_open | ( | int | chip, |
int | pin, | ||
peripheral_pwm_h * | pwm | ||
) |
Opens the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Remarks:
- pwm should be released with peripheral_pwm_close()
- Parameters:
-
[in] chip The PWM chip number [in] pin The PWM pin(channel) number to control [out] pwm The PWM handle is created on success
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
- Postcondition:
- peripheral_pwm_close()
int peripheral_pwm_set_duty_cycle | ( | peripheral_pwm_h | pwm, |
uint32_t | duty_cycle_ns | ||
) |
Sets duty cycle of the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] pwm The PWM handle [in] duty_cycle_ns The duty cycle of the PWM pin (in nanoseconds)
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
int peripheral_pwm_set_enabled | ( | peripheral_pwm_h | pwm, |
bool | enabled | ||
) |
Enables the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] pwm The PWM handle [in] enabled Enable/disable the PWM pin
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
int peripheral_pwm_set_period | ( | peripheral_pwm_h | pwm, |
uint32_t | period_ns | ||
) |
Sets period of the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] pwm The PWM handle [in] period_ns The total period of the PWM pin (in nanoseconds)
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
int peripheral_pwm_set_polarity | ( | peripheral_pwm_h | pwm, |
peripheral_pwm_polarity_e | polarity | ||
) |
Sets polarity of the PWM pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] pwm The PWM handle [in] polarity The polarity of the PWM pin
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
PERIPHERAL_ERROR_NONE Successful PERIPHERAL_ERROR_IO_ERROR I/O operation failed PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter PERIPHERAL_ERROR_NOT_SUPPORTED Not supported PERIPHERAL_ERROR_UNKNOWN Unknown internal error
- See also:
- peripheral_pwm_polarity_e