X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fdc_motor.h;h=f6fc6c57afa114ba9f354a26d93c28c1c10ed27e;hb=c00549cc35cb40d68160db6addb24cc82afe052e;hp=cf7b49052c2edde773168bf6ad9bae28b018f515;hpb=b9c96114f83504fc6492d7aad95aaeb5d68532ac;p=bertos.git diff --git a/bertos/drv/dc_motor.h b/bertos/drv/dc_motor.h index cf7b4905..f6fc6c57 100644 --- a/bertos/drv/dc_motor.h +++ b/bertos/drv/dc_motor.h @@ -31,7 +31,7 @@ * * * \brief DC motor driver. -* + * * \author Daniele Basile * * $WIZ$ module_name = "dc_motor" @@ -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. + +#if !CFG_PWM_ENABLE_OLD_API + Pwm pwm; // Pwm context +#endif - int index; ///< DC motor id. - uint32_t status; ///< Status of select DC motor - dc_speed_t tgt_speed; ///< Target speed for select DC motor + 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 + ticks_t expire_time; // Amount of time that dc motor run } DCMotor;