Skip to content

Commit

Permalink
Refactor motor driver code and remove unnecessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperChamp234 committed Jan 31, 2024
1 parent 294b8ce commit de01768
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 5 additions & 3 deletions examples/motor_driver_normal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@
#include "freertos/task.h"
#include "sra_board.h"

static const char* TAG = "MOTOR";

void app_main(void)
{
motor_handle_t motor1;
enable_motor_driver(&motor1, MOTOR_A_1);
while(1){
set_motor_speed(motor1, MOTOR_FORWARD, 60);
ESP_LOGI("MOTOR", "Forward");
ESP_LOGI(TAG, "Forward");
vTaskDelay(1000 / portTICK_PERIOD_MS);
set_motor_speed(motor1, MOTOR_BACKWARD, 60);
ESP_LOGI("MOTOR", "Backward");
ESP_LOGI(TAG, "Backward");
vTaskDelay(1000 / portTICK_PERIOD_MS);
set_motor_speed(motor1, MOTOR_STOP, 0);
ESP_LOGI("MOTOR", "Stop");
ESP_LOGI(TAG, "Stop");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
4 changes: 0 additions & 4 deletions src/mcpwm_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
* SOFTWARE.
*/

#include <stdlib.h>
#include <string.h>
#include <sys/cdefs.h>

#include "esp_log.h"
#include "driver/mcpwm_prelude.h"
#include "esp_check.h"
#include "mcpwm_interface.h"
Expand Down
2 changes: 0 additions & 2 deletions src/motor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* SOFTWARE.
*/

#include "esp_log.h"
#include "esp_check.h"
#include "motor_driver.h"
#include "utils.h"
#include "pin_defs.h"
Expand Down

0 comments on commit de01768

Please sign in to comment.