mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
echoplayer: implement basic power-on / power-off logic
Use cpu_power_on as a GPIO to keep the main power supply enabled when running from battery. Change-Id: Ic79283a0cc640585a0297e11f9dcc2264ec9af26
This commit is contained in:
parent
e29780fe09
commit
671320b5d1
4 changed files with 24 additions and 1 deletions
|
|
@ -119,6 +119,10 @@ void main(void)
|
|||
demo_page -= 1;
|
||||
break;
|
||||
|
||||
case BUTTON_X:
|
||||
power_off();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,24 @@ void power_init(void)
|
|||
|
||||
void power_off(void)
|
||||
{
|
||||
gpio_set_level(GPIO_CPU_POWER_ON, 0);
|
||||
|
||||
/* TODO: reset to bootloader if USB is plugged in */
|
||||
while (1)
|
||||
core_idle();
|
||||
}
|
||||
|
||||
void system_reboot(void)
|
||||
{
|
||||
/*
|
||||
* TODO: support reboot
|
||||
*
|
||||
* For R1-Rev1 PCBs doing a CPU reset will cut power when
|
||||
* running on battery (because cpu_power_on is no longer
|
||||
* being driven high). The RTC alarm could be used to wake
|
||||
* the system instead.
|
||||
*/
|
||||
power_off();
|
||||
}
|
||||
|
||||
unsigned int power_input_status(void)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static const struct gpio_setting gpios[] = {
|
|||
STM_DEFGPIO(GPIO_BUTTON_VOL_DOWN, F_INPUT_PU),
|
||||
STM_DEFGPIO(GPIO_BUTTON_POWER, F_INPUT_PD),
|
||||
STM_DEFGPIO(GPIO_BUTTON_HOLD, F_INPUT_PU),
|
||||
STM_DEFGPIO(GPIO_CPU_POWER_ON, F_LPTIM4_OUT),
|
||||
STM_DEFGPIO(GPIO_CPU_POWER_ON, F_OUT_LS(1)), /* active high */
|
||||
STM_DEFGPIO(GPIO_POWER_1V8, F_OUT_LS(0)), /* active high */
|
||||
STM_DEFGPIO(GPIO_CODEC_AVDD_EN, F_OUT_LS(1)), /* active low */
|
||||
STM_DEFGPIO(GPIO_CODEC_DVDD_EN, F_OUT_LS(1)), /* active low */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
****************************************************************************/
|
||||
#include "system.h"
|
||||
#include "tick.h"
|
||||
#include "button.h"
|
||||
#include "clock-stm32h7.h"
|
||||
#include "gpio-stm32h7.h"
|
||||
#include "regs/cortex-m/cm_scb.h"
|
||||
|
|
@ -154,7 +155,11 @@ void mdelay(uint32_t ms)
|
|||
|
||||
void system_exception_wait(void)
|
||||
{
|
||||
#if defined(ECHO_R1)
|
||||
while (button_read_device() != (BUTTON_POWER | BUTTON_START));
|
||||
#else
|
||||
while (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
int system_memory_guard(int newmode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue