static void init_ulp_program() { esp_err_t err = ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t)); ESP_ERROR_CHECK(err); /* Configure ADC channel */ /* Note: when changing channel here, also change 'adc_channel' constant in adc.S */ adc1_config_channel_atten(ADC1_CHANNEL_6, ADC_ATTEN_DB_11); adc1_config_width(ADC_WIDTH_BIT_12); adc1_ulp_enable(); /* Set low and high thresholds, approx. 1.35V - 1.75V*/ ulp_low_thr = 1500; ulp_high_thr = 2000; /* Set ULP wake up period to 20ms */ ulp_set_wakeup_period(0, 20000); /* Disconnect GPIO12 and GPIO15 to remove current drain through * pullup/pulldown resistors. * GPIO15 may be connected to ground to suppress boot messages. * GPIO12 may be pulled high to select flash voltage. */ rtc_gpio_isolate(GPIO_NUM_12); rtc_gpio_isolate(GPIO_NUM_15); }
static void init_ulp_program() { esp_err_t err = ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t)); ESP_ERROR_CHECK(err); /* Configure ADC channel */ /* Note: when changing channel here, also change 'adc_channel' constant in adc.S */ adc1_config_channel_atten(ADC1_CHANNEL_6, ADC_ATTEN_11db); adc1_config_width(ADC_WIDTH_12Bit); adc1_ulp_enable(); /* Set low and high thresholds, approx. 1.35V - 1.75V*/ ulp_low_thr = 1500; ulp_high_thr = 2000; /* Set ULP wake up period to 100ms */ ulp_set_wakeup_period(0, 100000); }