X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fdc_motor.h;h=f6fc6c57afa114ba9f354a26d93c28c1c10ed27e;hb=4278d44ef7681c56f4bd16615c3c4d9338112df4;hp=949420759747d5674dfbae782c5fe3f9639a7d36;hpb=2d5fcab20798f629fe456e7c61efbb23d0b5acbc;p=bertos.git diff --git a/bertos/drv/dc_motor.h b/bertos/drv/dc_motor.h index 94942075..f6fc6c57 100644 --- a/bertos/drv/dc_motor.h +++ b/bertos/drv/dc_motor.h @@ -46,6 +46,7 @@ #include "hw/hw_dc_motor.h" #include "cfg/cfg_dc_motor.h" +#include "cfg/cfg_pwm.h" #include #include @@ -70,7 +71,7 @@ typedef struct DCMotorConfig PidCfg pid_cfg; ///< Pid control. bool pid_enable; ///< Flag to disable or enable pid control. - PwmDev pwm_dev; ///< Pwm channel. + unsigned pwm_dev; ///< Pwm channel. pwm_freq_t freq; ///< Pwm waveform frequency. adc_ch_t adc_ch; ///< ADC channel. @@ -92,14 +93,18 @@ typedef struct DCMotorConfig */ typedef struct DCMotor { - const DCMotorConfig *cfg; ///< All configuration for select DC motor. - PidContext pid_ctx; ///< Pid control. + const DCMotorConfig *cfg; // All configuration for select DC motor. + PidContext pid_ctx; // Pid control. - int index; ///< DC motor id. - uint32_t status; ///< Status of select DC motor - dc_speed_t tgt_speed; ///< Target speed for select DC motor +#if !CFG_PWM_ENABLE_OLD_API + Pwm pwm; // Pwm context +#endif - ticks_t expire_time; ///< Amount of time that dc motor run + int index; // DC motor id. + uint32_t status; // Status of select DC motor + dc_speed_t tgt_speed; // Target speed for select DC motor + + ticks_t expire_time; // Amount of time that dc motor run } DCMotor;