ULP: Add example of using GPIO to wakeup the ULP-RISCV processor

This commit is contained in:
Marius Vikhammer
2022-02-28 12:05:48 +08:00
parent 36c8dc59dd
commit c974a000d7
10 changed files with 261 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* ULP-RISC-V example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
This code runs on ULP-RISC-V coprocessor
*/
#include "ulp_riscv.h"
#include "ulp_riscv_utils.h"
int main (void)
{
ulp_riscv_wakeup_main_processor();
/* Wakeup interrupt is a level interrupt, wait 1 sec to
allow user to release button to avoid waking up the ULP multiple times */
ulp_riscv_delay_cycles(1000*1000 * ULP_RISCV_CYCLES_PER_US);
ulp_riscv_gpio_wakeup_clear();
/* ulp_riscv_halt() is called automatically when main exits */
return 0;
}