[FL-1221] Hardware info CLI command #481

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich 2021-05-21 12:57:52 +03:00 committed by GitHub
parent 1242327e14
commit 6d93f04f13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@
#include <api-hal-gpio.h>
#include <rtc.h>
#include <task-control-block.h>
#include <time.h>
void cli_command_help(Cli* cli, string_t args, void* context) {
(void)args;
@ -90,6 +91,19 @@ void cli_command_log(Cli* cli, string_t args, void* context) {
furi_stdglue_set_global_stdout_callback(NULL);
}
void cli_command_hw_info(Cli* cli, string_t args, void* context) {
printf(
"%-20s %d.F%dB%dC%d\r\n",
"HW version:",
api_hal_version_get_hw_version(),
api_hal_version_get_hw_target(),
api_hal_version_get_hw_body(),
api_hal_version_get_hw_connect());
time_t time = api_hal_version_get_hw_timestamp();
printf("%-20s %s\r", "Production date:", ctime(&time));
printf("%-20s %s", "Name:", api_hal_version_get_name_ptr());
}
void cli_command_vibro(Cli* cli, string_t args, void* context) {
if(!string_cmp(args, "0")) {
api_hal_vibro_on(false);
@ -227,6 +241,7 @@ void cli_commands_init(Cli* cli) {
cli_add_command(cli, "uid", cli_command_uuid, NULL);
cli_add_command(cli, "date", cli_command_date, NULL);
cli_add_command(cli, "log", cli_command_log, NULL);
cli_add_command(cli, "hw_info", cli_command_hw_info, NULL);
cli_add_command(cli, "vibro", cli_command_vibro, NULL);
cli_add_command(cli, "led", cli_command_led, NULL);
cli_add_command(cli, "gpio_set", cli_command_gpio_set, NULL);