Skip to content

Commit 3f3b90b

Browse files
Damian-Nordicrlubos
authored andcommitted
nrf_rpc: add Kconfig to configure default group flags
By default, groups defined with NRF_RPC_GROUP_DEFINE() are initiators (send an init packet to the peer) and wait for initialization (until they receive an init packet from the peer). Make it possible to override these settings with Kconfig so that one can decide which device is an initiator and which is a responder. Signed-off-by: Damian Krolik <[email protected]>
1 parent 545ef5d commit 3f3b90b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

nrf_rpc/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ config NRF_RPC_GROUP_INIT_WAIT_TIME
4646
The number of milliseconds to wait for the remote cores to send group
4747
init packets with destination group IDs. Set to -1 to wait forever.
4848

49+
config NRF_RPC_GROUP_DEFAULT_INITIATOR
50+
bool "Initiate group binding by default"
51+
default y
52+
help
53+
For each group defined with NRF_RPC_GROUP_DEFINE macro, initiate the
54+
group binding when calling nrf_rpc_init(). This is achieved by sending
55+
an initialization packet to the peer.
56+
57+
config NRF_RPC_GROUP_DEFAULT_WAIT_ON_INIT
58+
bool "Wait for group binding by default"
59+
default y
60+
help
61+
For each group defined with NRF_RPC_GROUP_DEFINE macro, wait until the
62+
group is bound when calling nrf_rpc_init().
63+
4964
config NRF_RPC_THREAD_POOL_SIZE
5065
int "Number of threads in local thread pool"
5166
default 3

nrf_rpc/include/nrf_rpc.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ struct nrf_rpc_cleanup_handler
252252
* error occurred in context of this group. Can be NULL if
253253
* group does not want to receive error notifications.
254254
*/
255-
#define NRF_RPC_GROUP_DEFINE(_name, _strid, _transport, _ack_handler, _ack_data, \
256-
_err_handler) \
257-
NRF_RPC_GROUP_DEFINE_INTERNAL__(_name, _strid, _transport, _ack_handler, \
258-
_ack_data, _err_handler, NULL, true, \
259-
true) \
255+
#define NRF_RPC_GROUP_DEFINE(_name, _strid, _transport, _ack_handler, _ack_data, _err_handler) \
256+
NRF_RPC_GROUP_DEFINE_INTERNAL__(_name, _strid, _transport, _ack_handler, _ack_data, \
257+
_err_handler, NULL, \
258+
IS_ENABLED(CONFIG_NRF_RPC_GROUP_DEFAULT_WAIT_ON_INIT), \
259+
IS_ENABLED(CONFIG_NRF_RPC_GROUP_DEFAULT_INITIATOR))
260260

261261
/** @brief Define a non-blocking group of commands and events.
262262
*

0 commit comments

Comments
 (0)