IO初始化出错
Posted: Tue Jan 17, 2023 4:11 am
1.IO口设置成输出状态,实际执行出来的却是输入请问是什么原因?
2.IO口宏定义成数字时,直接赋值给gpio_reset_pin等函数会提示数据类型错误,需要在宏定义时加入(gpio_num_t)强制类型转换,不过例程都不需要,是怎么回事?
2.IO口宏定义成数字时,直接赋值给gpio_reset_pin等函数会提示数据类型错误,需要在宏定义时加入(gpio_num_t)强制类型转换,不过例程都不需要,是怎么回事?
Code: Select all
#define LED_B ((gpio_num_t)4)
#define LED_W ((gpio_num_t)2)
ESP_LOGI(TAG, "Hello, OB_helth!");
st_key_queue = xQueueCreate(1, sizeof(enum SYS_KEY_STATE));
power_state_Semaphore = xSemaphoreCreateBinary();
gpio_reset_pin(LED_B);
gpio_reset_pin(LED_W);
gpio_set_direction(LED_B, GPIO_MODE_OUTPUT);
gpio_set_direction(LED_W, GPIO_MODE_OUTPUT);
gpio_set_level(LED_B, 1);
gpio_set_level(LED_W, 0);
ESP_LOGI(TAG, "LED INIT");
I (315) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (325) app_main: Hello, OB_helth!
I (325) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (335) gpio: GPIO[2]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (345) app_main: LED INIT
I (355) motor: MOTOR_deal