From 3d1d4fe15066e2085124ca535894052fed22176c Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Fri, 30 Jun 2017 15:46:31 +0800 Subject: [PATCH] build: Fix the warnings that break the tests 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 | 3 ++- .../main/mcpwm_basic_config_example.c | 4 ++++ .../mcpwm_bldc_control_hall_sensor_example.c | 17 ++++++++++++++--- .../main/mcpwm_servo_control_example.c | 10 ---------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/components/fatfs/src/ff.c b/components/fatfs/src/ff.c index 53361e50fd..1675d644ad 100644 --- a/components/fatfs/src/ff.c +++ b/components/fatfs/src/ff.c @@ -3673,8 +3673,9 @@ FRESULT f_sync ( FATFS *fs; DWORD tm; BYTE *dir; +#if _FS_EXFAT DEF_NAMBUF - +#endif res = validate(&fp->obj, &fs); /* Check validity of the file object */ if (res == FR_OK) { diff --git a/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c b/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c index f4ace70c03..3fc02e6dad 100644 --- a/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c +++ b/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c @@ -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 diff --git a/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c index 772a39176c..58c4b06cbe 100644 --- a/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c +++ b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c @@ -27,7 +27,10 @@ #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); } diff --git a/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c b/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c index cbc07e1059..1a7557379f 100644 --- a/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c +++ b/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c @@ -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 */