]> granicus.if.org Git - esp-idf/commitdiff
build: Fix the warnings that break the tests
authorAnton Maklakov <anton@espressif.com>
Fri, 30 Jun 2017 07:46:31 +0000 (15:46 +0800)
committerAnton Maklakov <anton@espressif.com>
Fri, 7 Jul 2017 03:03:25 +0000 (11:03 +0800)
    unused variable 'lfn'
    'isr_handler' defined but not used
    'servo_set_angle' defined but not used
    'gpio_test_signal' defined but not used
    'change_duty' defined but not used

components/fatfs/src/ff.c
examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c
examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c
examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c

index 53361e50fd1f9426542b9cef2b305bb9dfc73cc4..1675d644ad1954f9759dd985ee8c19fd76262776 100644 (file)
@@ -3673,8 +3673,9 @@ FRESULT f_sync (
        FATFS *fs;\r
        DWORD tm;\r
        BYTE *dir;\r
+#if _FS_EXFAT\r
        DEF_NAMBUF\r
-\r
+#endif\r
 \r
        res = validate(&fp->obj, &fs);  /* Check validity of the file object */\r
        if (res == FR_OK) {\r
index f4ace70c035e80dc07f16c967300b43ad7444c4f..3fc02e6dade094eed8adef5a198b4fa8164f6cb0 100644 (file)
@@ -59,7 +59,9 @@ typedef struct {
 } capture;
 
 xQueueHandle cap_queue;
+#if MCPWM_EN_CAPTURE
 static mcpwm_dev_t *MCPWM[2] = {&MCPWM0, &MCPWM1};
+#endif
 
 static void mcpwm_example_gpio_initialize()
 {
@@ -162,6 +164,7 @@ static void disp_captured_signal(void *arg)
     }
 }
 
+#if MCPWM_EN_CAPTURE
 /**
  * @brief this is ISR handler function, here we check for interrupt that triggers rising edge on CAP0 signal and according take action
  */
@@ -187,6 +190,7 @@ static void IRAM_ATTR isr_handler()
     }
     MCPWM[MCPWM_UNIT_0]->int_clr.val = mcpwm_intr_status;
 }
+#endif
 
 /**
  * @brief Configure whole MCPWM module
index 772a39176c975c6881c24609514d74421101003e..58c4b06cbef231fe39ed9a151b6e33daaa0f0ab2 100644 (file)
 #include "soc/mcpwm_struct.h"
 
 #define INITIAL_DUTY 10.0   //initial duty cycle is 10.0%
-#define MCPWM_GPIO_INIT 0    //select which function to use to initialize gpio signals
+#define MCPWM_GPIO_INIT 0   //select which function to use to initialize gpio signals
+
+#define GPIO_HALL_TEST_SIGNAL 0     //Make this 1 to enable generation of hall sensors test signal on GPIO13, 12, 14
+#define CHANGE_DUTY_CONTINUOUSLY 0  //Make this 1 to change duty continuously
 
 #define CAP_SIG_NUM 3   //three capture signals from HALL-A, HALL-B, HALL-C
 #define CAP0_INT_EN BIT(27)  //Capture 0 interrupt bit
@@ -94,6 +97,7 @@ static void mcpwm_example_gpio_initialize()
     gpio_pulldown_en(GPIO_CAP2_IN);    //Enable pull down on CAP2   signal
 }
 
+#if GPIO_HALL_TEST_SIGNAL
 /**
  * @brief Set gpio 13, 12, 14  as our test signal of hall sensors, that generates high-low waveform continuously
  *        Attach this pins to GPIO 27, 26, 25 respectively for capture unit
@@ -123,6 +127,7 @@ static void gpio_test_signal(void *arg)
         vTaskDelay(1);
     }
 }
+#endif
 
 /**
  * @brief When interrupt occurs, we receive the counter value and display the time between two rising edge
@@ -181,6 +186,7 @@ static void IRAM_ATTR isr_handler()
     MCPWM[MCPWM_UNIT_0]->int_clr.val = mcpwm_intr_status;
 }
 
+#if CHANGE_DUTY_CONTINUOUSLY
 static void change_duty(void *arg)
 {
     int j;
@@ -197,6 +203,7 @@ static void change_duty(void *arg)
         }
     }
 }
+#endif
 
 /**
  * @brief Configure whole MCPWM module for bldc motor control
@@ -304,9 +311,13 @@ static void mcpwm_example_bldc_control(void *arg)
 void app_main()
 {
     printf("Testing MCPWM BLDC Control...\n");
-    //xTaskCreate(change_duty, "change_duty", 2048, NULL, 2, NULL); //uncomment to change duty continuously
+#if CHANGE_DUTY_CONTINUOUSLY
+    xTaskCreate(change_duty, "change_duty", 2048, NULL, 2, NULL);
+#endif
     cap_queue = xQueueCreate(1, sizeof(capture)); //comment if you don't want to use capture module
-    //xTaskCreate(gpio_test_signal, "gpio_test_signal", 2048, NULL, 2, NULL);
+#if GPIO_HALL_TEST_SIGNAL
+    xTaskCreate(gpio_test_signal, "gpio_test_signal", 2048, NULL, 2, NULL);
+#endif
     xTaskCreate(disp_captured_signal, "mcpwm_config", 4096, NULL, 2, NULL);  //comment if you don't want to use capture module
     xTaskCreate(mcpwm_example_bldc_control, "mcpwm_example_bldc_control", 4096, NULL, 2, NULL);
 }
index cbc07e10597deb835c4ccb0b450d1adeb004d495..1a7557379fa17d42a7eacb4b5a758eaccd7a0ea0 100644 (file)
@@ -42,16 +42,6 @@ static uint32_t servo_per_degree_init(uint32_t degree_of_rotation)
     return cal_pulsewidth;
 }
 
-/**
- * @brief directly set servo motor to a particular angle
- */
-static void servo_set_angle(uint32_t angle_of_rotation)
-{
-    uint32_t angle_t;
-    angle_t = servo_per_degree_init(angle_of_rotation);
-    mcpwm_set_duty_in_us(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A, angle_t);
-}
-
 /**
  * @brief Configure MCPWM module
  */