driver(gpio) : Fixed the gpio related bug for release v3.1.

This commit is contained in:
hou wen xiang
2018-06-04 10:34:23 +08:00
committed by XiongYu
parent 01efe9a300
commit 5402ace528
3 changed files with 26 additions and 5 deletions

View File

@@ -13,13 +13,16 @@
#include "freertos/task.h"
#include "freertos/queue.h"
#define WAKE_UP_IGNORE 1 // gpio_wakeup function development is not completed yet, set it deprecated.
#define GPIO_OUTPUT_IO 18 // default output GPIO
#define GPIO_INPUT_IO 19 // default input GPIO
#define GPIO_OUTPUT_MAX GPIO_NUM_34
static volatile int disable_intr_times = 0; // use this to calculate how many times it go into interrupt
static volatile int level_intr_times = 0; // use this to get how many times the level interrupt happened
static volatile int edge_intr_times = 0; // use this to get how many times the edge interrupt happened
#if !WAKE_UP_IGNORE
static bool wake_up_result = false; // use this to judge the wake up event happen or not
#endif
/**
* do some initialization operation in this function
@@ -70,6 +73,7 @@ static void gpio_isr_level_handler2(void* arg)
ets_printf("GPIO[%d] intr, val: %d, level_intr_times = %d\n", gpio_num, gpio_get_level(gpio_num), level_intr_times);
}
#if !WAKE_UP_IGNORE
// get result of waking up or not
static void sleep_wake_up(void *arg)
{
@@ -92,7 +96,7 @@ static void trigger_wake_up(void *arg)
gpio_set_level(GPIO_OUTPUT_IO, 1);
vTaskDelay(100 / portTICK_RATE_MS);
}
#endif
static void prompt_to_continue(const char* str)
{
@@ -465,6 +469,7 @@ TEST_CASE("GPIO repeate call service and isr has no memory leak test","[gpio][te
TEST_ASSERT_INT32_WITHIN(size, esp_get_free_heap_size(), 100);
}
#if !WAKE_UP_IGNORE
//this function development is not completed yet, set it ignored
TEST_CASE("GPIO wake up enable and disenable test", "[gpio][ignore]")
{
@@ -479,6 +484,7 @@ TEST_CASE("GPIO wake up enable and disenable test", "[gpio][ignore]")
vTaskDelay(100 / portTICK_RATE_MS);
TEST_ASSERT_FALSE(wake_up_result);
}
#endif
// this case need the resistance to pull up the voltage or pull down the voltage
// ignored because the voltage needs to be tested with multimeter