16int PowerCommand(
PowerManager* power,
int argc,
char** argv)
18 if (argc == 2 && std::strcmp(argv[1],
"reset") == 0)
23 if (argc == 2 && std::strcmp(argv[1],
"shutdown") == 0)
28 if (argc == 2 && std::strcmp(argv[1],
"bootloader") == 0)
33 STDIO::Print<
"usage: power reset|shutdown|bootloader\r\n">();
47 if (pin.
Read() == level)
通用输入输出(GPIO)接口类。 General Purpose Input/Output (GPIO) interface class.
virtual bool Read()=0
读取 GPIO 引脚状态 / Reads the GPIO pin state.
电源管理器基类 / Abstract base class for Power Manager
virtual void Reset()=0
复位电源管理模块 / Resets the power management module
virtual void Shutdown()=0
关闭系统电源 / Shuts down the system power
void RegisterCommand(RamFS &ramfs)
在 RamFS 根目录注册 power 命令 / Registers the power command in the RamFS root
void CheckBootloaderPin(GPIO &pin, bool level)
启动时按引脚电平进入启动加载器 / Pin-level bootloader entry at startup
virtual void JumpToBootloader()
跳转到启动加载器 / Jumps to the bootloader
文件节点片段 / File-node fragment
轻量级内存文件系统 / Lightweight in-memory file system
static File CreateCommand(const char *name, int(*exec)(ArgType arg, int argc, char **argv), ArgType &&arg)
创建命令兼容入口,返回可执行文件 / Create a command-compatible executable file
void Add(File &file)
添加文件节点到根目录 / Add a file node to the root directory
static int Print(Args &&... args)
将一个编译期 brace 字面量打印到当前 STDIO 输出 / Print one compile-time brace literal to the active STDIO output
LibXR 命名空间 / LibXR namespace.