ULP Loop
Posted: Tue Apr 12, 2022 10:04 pm
Can somebody help me how to make a 'for loop' in Arduino ULP
This is my code,
This is my code,
Code: Select all
#include "esp32/ulp.h"
#include "driver/rtc_io.h"
#include "UlpDebug.h"
void ULP_RUN();
void setup() {
Serial.begin(115200);
delay(1500);
Serial.println("GO");
ULP_RUN();
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
esp_deep_sleep(30000000);
}
void loop() {
}
void ULP_RUN() {
RTC_SLOW_MEM[12] = 0;
const ulp_ ulp_test[] = {
I_WR_REG(RTC_GPIO_OUT_REG, 26, 27, 1), // GPIO 2 --> HIGH
[b]LOOP HERE...
..for x = 1000
I_DELAY(15000), /*0,001875 sec*/
...end
[/b]
I_WR_REG(RTC_GPIO_OUT_REG, 26, 27, 0), // GPIO 2 --> LOW
I_HALT()
rtc_gpio_init(GPIO_NUM_2);
rtc_gpio_set_direction(GPIO_NUM_2, RTC_GPIO_MODE_OUTPUT_ONLY);
rtc_gpio_set_level(GPIO_NUM_2, 0);
size_t size = sizeof(ulp_test) / sizeof(ulp_);
ulp_process_macros_and_load(0, ulp_test, &size);
ulp_run(0);
}