1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/nimble/autoconn: allow conn interval range

This commit is contained in:
Hauke Petersen 2021-04-22 14:50:34 +02:00
parent 2a0f1ac634
commit c3c4b64f83
3 changed files with 14 additions and 7 deletions

View File

@ -145,8 +145,11 @@ typedef struct {
uint32_t scan_win;
/** opening a new connection is aborted after this time [in ms] */
uint32_t conn_timeout;
/** connection interval used when opening a new connection [in ms] */
uint32_t conn_itvl;
/** connection interval used when opening a new connection, lower bound.
* [in ms] */
uint32_t conn_itvl_min;
/** connection interval, upper bound [in ms] */
uint32_t conn_itvl_max;
/** slave latency used for new connections [in ms] */
uint16_t conn_latency;
/** supervision timeout used for new connections [in ms] */

View File

@ -51,8 +51,11 @@ extern "C" {
#ifndef NIMBLE_AUTOCONN_CONN_TIMEOUT_MS
#define NIMBLE_AUTOCONN_CONN_TIMEOUT_MS (3 * NIMBLE_AUTOCONN_SCAN_WIN_MS)
#endif
#ifndef NIMBLE_AUTOCONN_CONN_ITVL_MS
#define NIMBLE_AUTOCONN_CONN_ITVL_MS (75U) /* 75ms */
#ifndef NIMBLE_AUTOCONN_CONN_ITVL_MIN_MS
#define NIMBLE_AUTOCONN_CONN_ITVL_MIN_MS 75U /* 75ms */
#endif
#ifndef NIMBLE_AUTOCONN_CONN_ITVL_MAX_MS
#define NIMBLE_AUTOCONN_CONN_ITVL_MAX_MS 75U /* 75ms */
#endif
#ifndef NIMBLE_AUTOCONN_CONN_LATENCY
#define NIMBLE_AUTOCONN_CONN_LATENCY (0)
@ -74,7 +77,8 @@ extern "C" {
.scan_itvl = NIMBLE_AUTOCONN_SCAN_ITVL_MS, \
.scan_win = NIMBLE_AUTOCONN_SCAN_WIN_MS, \
.conn_timeout = NIMBLE_AUTOCONN_CONN_TIMEOUT_MS, \
.conn_itvl = NIMBLE_AUTOCONN_CONN_ITVL_MS, \
.conn_itvl_min = NIMBLE_AUTOCONN_CONN_ITVL_MIN_MS, \
.conn_itvl_max = NIMBLE_AUTOCONN_CONN_ITVL_MAX_MS, \
.conn_latency = NIMBLE_AUTOCONN_CONN_LATENCY, \
.conn_super_to = NIMBLE_AUTOCONN_CONN_SVTO_MS, \
.node_id = NIMBLE_AUTOCONN_NODE_ID, }

View File

@ -277,8 +277,8 @@ int nimble_autoconn_update(const nimble_autoconn_params_t *params,
/* populate the connection parameters */
_conn_params.scan_itvl = BLE_GAP_SCAN_ITVL_MS(params->scan_win);
_conn_params.scan_window = _conn_params.scan_itvl;
_conn_params.itvl_min = BLE_GAP_CONN_ITVL_MS(params->conn_itvl);
_conn_params.itvl_max = _conn_params.itvl_min;
_conn_params.itvl_min = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_min);
_conn_params.itvl_max = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_max);
_conn_params.latency = 0;
_conn_params.supervision_timeout = BLE_GAP_SUPERVISION_TIMEOUT_MS(
params->conn_super_to);