rtcio: add hal for driver

This commit is contained in:
fuzhibo
2019-07-25 23:11:31 +08:00
parent b30b0e59fa
commit 0c2bf7c8bc
31 changed files with 2022 additions and 824 deletions

View File

@@ -49,7 +49,8 @@ static void init_ulp_program(void)
/* GPIO used for pulse counting. */
gpio_num_t gpio_num = GPIO_NUM_0;
assert(rtc_gpio_desc[gpio_num].reg && "GPIO used for pulse counting must be an RTC IO");
int rtcio_num = rtc_io_number_get(gpio_num);
assert(rtc_gpio_is_valid_gpio(gpio_num) && "GPIO used for pulse counting must be an RTC IO");
/* Initialize some variables used by ULP program.
* Each 'ulp_xyz' variable corresponds to 'xyz' variable in the ULP program.
@@ -63,7 +64,7 @@ static void init_ulp_program(void)
ulp_debounce_counter = 3;
ulp_debounce_max_count = 3;
ulp_next_edge = 0;
ulp_io_number = rtc_gpio_desc[gpio_num].rtc_num; /* map from GPIO# to RTC_IO# */
ulp_io_number = rtcio_num; /* map from GPIO# to RTC_IO# */
ulp_edge_count_to_wake_up = 10;
/* Initialize selected GPIO as RTC IO, enable input, disable pullup and pulldown */