2022-07-08 02:11:19 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2022-6-30 GuEe-GUI first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rtdevice.h>
|
|
|
|
|
|
|
|
#ifdef RT_USING_PIN
|
|
|
|
|
|
|
|
void qemu_gpio3_key_poweroff(void *args)
|
|
|
|
{
|
|
|
|
rt_kprintf("\nYou power off the machine.\n");
|
|
|
|
|
|
|
|
rt_hw_cpu_shutdown();
|
|
|
|
}
|
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
static int pin_init()
|
2022-07-08 02:11:19 +08:00
|
|
|
{
|
|
|
|
rt_pin_attach_irq(3, PIN_IRQ_MODE_FALLING, qemu_gpio3_key_poweroff, RT_NULL);
|
|
|
|
rt_pin_irq_enable(3, RT_TRUE);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
INIT_ENV_EXPORT(pin_init);
|
|
|
|
|
|
|
|
#endif /* RT_USING_PIN */
|