shell: Add a Segger RTT backend
Fixes: #8394 Signed-off-by: Christoph Schramm <schramm@makaio.com>
This commit is contained in:
parent
e8a59728e1
commit
f17a9c93b4
4 changed files with 173 additions and 0 deletions
46
include/shell/shell_rtt.h
Normal file
46
include/shell/shell_rtt.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Makaio GmbH
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef SHELL_RTT_H__
|
||||
#define SHELL_RTT_H__
|
||||
|
||||
#include <shell/shell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const struct shell_transport_api shell_rtt_transport_api;
|
||||
|
||||
struct shell_rtt {
|
||||
shell_transport_handler_t handler;
|
||||
struct k_timer timer;
|
||||
void *context;
|
||||
u8_t rx[5];
|
||||
size_t rx_cnt;
|
||||
};
|
||||
|
||||
#define SHELL_RTT_DEFINE(_name) \
|
||||
static struct shell_rtt _name##_shell_rtt; \
|
||||
struct shell_transport _name = { \
|
||||
.api = &shell_rtt_transport_api, \
|
||||
.ctx = (struct shell_rtt *)&_name##_shell_rtt \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function provides pointer to shell rtt backend instance.
|
||||
*
|
||||
* Function returns pointer to the shell rtt instance. This instance can be
|
||||
* next used with shell_execute_cmd function in order to test commands behavior.
|
||||
*
|
||||
* @returns Pointer to the shell instance.
|
||||
*/
|
||||
const struct shell *shell_backend_rtt_get_ptr(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SHELL_RTT_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue