1 /* 2 * Copyright 2023 Google LLC 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <stdio.h> 8 #include <zephyr/shell/shell.h> 9 #include <zephyr/shell/shell_dummy.h> 10 11 #define SLEEP_TIME_MS 200 12 #define CMD_BUF_LEN 128 13 main(void)14int main(void) 15 { 16 const struct shell *sh = shell_backend_dummy_get_ptr(); 17 bool val = false; 18 int err; 19 char buf[CMD_BUF_LEN]; 20 21 err = shell_execute_cmd(sh, "input dump on"); 22 if (err) { 23 printf("Failed to execute the shell command: %d.\n", 24 err); 25 } 26 27 while (true) { 28 snprintf(buf, 128, "input report 1 2 %d", val); 29 err = shell_execute_cmd(sh, buf); 30 if (err) { 31 printf("Failed to execute the shell command: %d.\n", 32 err); 33 } 34 35 val = !val; 36 37 k_msleep(SLEEP_TIME_MS); 38 } 39 40 return 0; 41 } 42