问题产生和描述
项目中使用ESP32S3 开发解决方案,其中涉及到低功耗部分,因为需求是长按唤醒,长按关机的需求,为保证良好的用户体验,需要弃用ulp.ULP 要在IDF4.4.4分支验证使用
参考乐鑫的ULP例子如下
static bool gpio_level = false;
/* this variable will be exported as a public symbol, visible from main CPU: */
bool gpio_level_previous = false;
int main (void)
{
gpio_level = (bool)ulp_riscv_gpio_get_level(GPIO_NUM_0);
gpio_level_previous = gpio_level;
while(1) {
gpio_level = (bool)ulp_riscv_gpio_get_level(GPIO_NUM_0);
/* Wakes up the main CPU if pin changed its state */
if(gpio_level != gpio_level_previous