Ai-Thinker-Open_RTL8710BX_A.../Living_SDK/include/hal/soc/pwm.h

57 lines
1.2 KiB
C
Raw Normal View History

2020-06-18 12:06:52 +00:00
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#ifndef HAL_PWM_H
#define HAL_PWM_H
typedef struct {
float duty_cycle; /* the pwm duty_cycle */
uint32_t freq; /* the pwm freq */
} pwm_config_t;
typedef struct {
uint8_t port; /* pwm port */
pwm_config_t config; /* spi config */
void *priv; /* priv data */
} pwm_dev_t;
/**
* Initialises a PWM pin
*
*
* @param[in] pwm the PWM device
*
* @return 0 : on success, EIO : if an error occurred with any step
*/
int32_t hal_pwm_init(pwm_dev_t *pwm);
/**
* Starts Pulse-Width Modulation signal output on a PWM pin
*
* @param[in] pwm the PWM device
*
* @return 0 : on success, EIO : if an error occurred with any step
*/
int32_t hal_pwm_start(pwm_dev_t *pwm);
/**
* Stops output on a PWM pin
*
* @param[in] pwm the PWM device
*
* @return 0 : on success, EIO : if an error occurred with any step
*/
int32_t hal_pwm_stop(pwm_dev_t *pwm);
/**
* De-initialises an PWM interface, Turns off an PWM hardware interface
*
* @param[in] pwm the interface which should be de-initialised
*
* @return 0 : on success, EIO : if an error occurred with any step
*/
int32_t hal_pwm_finalize(pwm_dev_t *pwm);
#endif /* HAL_PWM_H */