mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
mcpwm: bdc control example also support usb serial jtag
This commit is contained in:
parent
6672ec0692
commit
cb4fccb38a
@ -282,6 +282,9 @@ void cmd_mcpwm_motor_init(mcpwm_motor_control_t *motor_ctrl)
|
||||
#elif CONFIG_ESP_CONSOLE_USB_CDC
|
||||
esp_console_dev_usb_cdc_config_t cdc_config = ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_console_new_repl_usb_cdc(&cdc_config, &repl_config, &repl));
|
||||
#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
esp_console_dev_usb_serial_jtag_config_t usbjtag_config = ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_console_new_repl_usb_serial_jtag(&usbjtag_config, &repl_config, &repl));
|
||||
#endif
|
||||
|
||||
register_motor_ctrl_config();
|
||||
|
@ -118,9 +118,9 @@ static int pcnt_get_pulse_callback(void *args)
|
||||
static void motor_ctrl_default_init(void)
|
||||
{
|
||||
motor_ctrl.cfg.pid_enable = true;
|
||||
motor_ctrl.pid_param.kp = 0.8;
|
||||
motor_ctrl.pid_param.ki = 0.0;
|
||||
motor_ctrl.pid_param.kd = 0.1;
|
||||
motor_ctrl.pid_param.kp = 0.6;
|
||||
motor_ctrl.pid_param.ki = 0.4;
|
||||
motor_ctrl.pid_param.kd = 0.2;
|
||||
motor_ctrl.pid_param.cal_type = PID_CAL_TYPE_INCREMENTAL;
|
||||
motor_ctrl.pid_param.max_output = 100;
|
||||
motor_ctrl.pid_param.min_output = -100;
|
||||
|
@ -17,10 +17,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GPIO_PWM0A_OUT 15 //Set GPIO 15 as PWM0A
|
||||
#define GPIO_PWM0B_OUT 16 //Set GPIO 16 as PWM0B
|
||||
#define GPIO_PCNT_PINA 18 //Set GPIO 18 as phaseA/C1
|
||||
#define GPIO_PCNT_PINB 19 //Set GPIO 19 as phaseB/C2
|
||||
#define GPIO_PWM0A_OUT 7 //Set GPIO 15 as PWM0A
|
||||
#define GPIO_PWM0B_OUT 15 //Set GPIO 16 as PWM0B
|
||||
#define GPIO_PCNT_PINA 36 //Set GPIO 18 as phaseA/C1
|
||||
#define GPIO_PCNT_PINB 35 //Set GPIO 19 as phaseB/C2
|
||||
|
||||
typedef enum {
|
||||
MOTOR_CTRL_MODE_FIXED = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user