nRF Connect SDK API
3.4.99
Toggle main menu visibility
Loading...
Searching...
No Matches
shell_bt_nus.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5
*/
6
7
#ifndef SHELL_BT_NUS_H_
8
#define SHELL_BT_NUS_H_
9
10
#include <zephyr/shell/shell.h>
11
#include <zephyr/bluetooth/conn.h>
12
#include <
bluetooth/services/nus.h
>
13
#include <zephyr/sys/ring_buffer.h>
14
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
extern
const
struct
shell_transport_api
shell_bt_nus_transport_api
;
27
29
struct
shell_bt_nus_ctrl_blk
{
30
struct
bt_conn *
conn
;
31
atomic_t
tx_busy
;
32
shell_transport_handler_t
handler
;
33
void
*
context
;
34
};
35
37
struct
shell_bt_nus
{
38
struct
shell_bt_nus_ctrl_blk
*
ctrl_blk
;
39
struct
ring_buf *
tx_ringbuf
;
40
struct
ring_buf *
rx_ringbuf
;
41
};
42
44
#define SHELL_BT_NUS_DEFINE(_name, _tx_ringbuf_size, _rx_ringbuf_size) \
45
static struct shell_bt_nus_ctrl_blk _name##_ctrl_blk; \
46
RING_BUF_DECLARE(_name##_tx_ringbuf, _tx_ringbuf_size); \
47
RING_BUF_DECLARE(_name##_rx_ringbuf, _rx_ringbuf_size); \
48
static const struct shell_bt_nus _name##_shell_bt_nus = { \
49
.ctrl_blk = &_name##_ctrl_blk, \
50
.tx_ringbuf = &_name##_tx_ringbuf, \
51
.rx_ringbuf = &_name##_rx_ringbuf, \
52
}; \
53
struct shell_transport _name = { \
54
.api = &shell_bt_nus_transport_api, \
55
.ctx = (struct shell_bt_nus *)&_name##_shell_bt_nus \
56
}
57
66
int
shell_bt_nus_init
(
void
);
67
75
void
shell_bt_nus_enable
(
struct
bt_conn *conn);
76
80
void
shell_bt_nus_disable
(
void
);
81
82
#ifdef __cplusplus
83
}
84
#endif
85
89
90
#endif
/* SHELL_BT_NUS_H_ */
shell_bt_nus_transport_api
const struct shell_transport_api shell_bt_nus_transport_api
shell_bt_nus_enable
void shell_bt_nus_enable(struct bt_conn *conn)
Enable the NUS shell transport instance.
shell_bt_nus_init
int shell_bt_nus_init(void)
Initialize the NUS shell transport instance.
shell_bt_nus_disable
void shell_bt_nus_disable(void)
Disable the NUS shell transport instance.
nus.h
shell_bt_nus_ctrl_blk::conn
struct bt_conn * conn
Definition
shell_bt_nus.h:30
shell_bt_nus_ctrl_blk::tx_busy
atomic_t tx_busy
Definition
shell_bt_nus.h:31
shell_bt_nus_ctrl_blk::context
void * context
Definition
shell_bt_nus.h:33
shell_bt_nus_ctrl_blk::handler
shell_transport_handler_t handler
Definition
shell_bt_nus.h:32
shell_bt_nus_ctrl_blk
Instance control block (RW data).
Definition
shell_bt_nus.h:29
shell_bt_nus::rx_ringbuf
struct ring_buf * rx_ringbuf
Definition
shell_bt_nus.h:40
shell_bt_nus::ctrl_blk
struct shell_bt_nus_ctrl_blk * ctrl_blk
Definition
shell_bt_nus.h:38
shell_bt_nus::tx_ringbuf
struct ring_buf * tx_ringbuf
Definition
shell_bt_nus.h:39
shell_bt_nus
Instance structure.
Definition
shell_bt_nus.h:37
include
shell
shell_bt_nus.h
Generated on
for nRF Connect SDK API by
1.17.0