34 lines
856 B
C
34 lines
856 B
C
/*
|
|
* stm32f4_pwm.h
|
|
*
|
|
* Created on: Aug 9, 2016
|
|
* Author: tkl
|
|
*/
|
|
|
|
#ifndef SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_INCLUDE_STM32F4_PWM_H_
|
|
#define SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_INCLUDE_STM32F4_PWM_H_
|
|
|
|
#pragma pack(push)
|
|
#pragma pack(1)
|
|
struct stm32f4_pwm {
|
|
const struct stm32f4_gpio *pwm_gpio;
|
|
TIM_HandleTypeDef *timer_handle;
|
|
TIM_OC_InitTypeDef *output_compare_cfg;
|
|
TIM_MasterConfigTypeDef *master_cfg;
|
|
uint32_t channel;
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
|
|
int stm32f4_pwm_open(const void *pwm);
|
|
int stm32f4_pwm_close(const void *pwm);
|
|
int stm32f4_pwm_set_duty_cycle(const void *pwm, unsigned int duty_cycle_percent);
|
|
|
|
static const struct pwm_fp stm32f4_pwm_fp = {
|
|
.open = stm32f4_pwm_open,
|
|
.close = stm32f4_pwm_close,
|
|
.set_duty_cycle = stm32f4_pwm_set_duty_cycle,
|
|
};
|
|
|
|
#endif /* SOURCE_FIRMWARE_ARCH_STM32F4XX_DRIVER_INCLUDE_STM32F4_PWM_H_ */
|