4848#include "ble_client.h"
4949#include "platform.h"
5050
51- enum {
52- UNIT_0_625_MS = 625 , /**< Number of microseconds in 0.625 milliseconds. */
53- UNIT_1_25_MS = 1250 , /**< Number of microseconds in 1.25 milliseconds. */
54- UNIT_10_MS = 10000 /**< Number of microseconds in 10 milliseconds. */
55- };
56-
57- #define MSEC_TO_UNITS (TIME , RESOLUTION ) (((TIME) * 1000) / (RESOLUTION))
58-
59- /* Connection parameters used for Peripheral Preferred Connection Parameterss (PPCP) and update request */
60- #define MIN_CONN_INTERVAL MSEC_TO_UNITS(80, UNIT_1_25_MS)
61- #define MAX_CONN_INTERVAL MSEC_TO_UNITS(150, UNIT_1_25_MS)
62- #define SLAVE_LATENCY 0
63- #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(6000, UNIT_10_MS)
64-
6551/* Advertising parameters */
6652#define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */
6753#define BLE_GAP_ADV_FP_ANY 0x00 /**< Allow scan requests and connect requests from any device. */
@@ -496,7 +482,9 @@ BleStatus ble_client_init(ble_client_gap_event_cb_t gap_event_cb, void *gap_even
496482BleStatus ble_client_gap_set_enable_config (const char * name ,
497483 const ble_addr_t * bda ,
498484 const uint16_t appearance ,
499- const int8_t tx_power )
485+ const int8_t tx_power ,
486+ const uint16_t min_conn_interval ,
487+ const uint16_t max_conn_interval )
500488{
501489 struct ble_wr_config config ;
502490 BleStatus status ;
@@ -505,12 +493,12 @@ BleStatus ble_client_gap_set_enable_config(const char *name,
505493 config .p_name = (uint8_t * )name ;
506494 config .appearance = appearance ;
507495 config .tx_power = tx_power ;
508- config .peripheral_conn_params .interval_min = MIN_CONN_INTERVAL ;
509- config .peripheral_conn_params .interval_max = MAX_CONN_INTERVAL ;
496+ config .peripheral_conn_params .interval_min = min_conn_interval ;
497+ config .peripheral_conn_params .interval_max = max_conn_interval ;
510498 config .peripheral_conn_params .slave_latency = SLAVE_LATENCY ;
511499 config .peripheral_conn_params .link_sup_to = CONN_SUP_TIMEOUT ;
512- config .central_conn_params .interval_min = MIN_CONN_INTERVAL ;
513- config .central_conn_params .interval_max = MAX_CONN_INTERVAL ;
500+ config .central_conn_params .interval_min = min_conn_interval ;
501+ config .central_conn_params .interval_max = max_conn_interval ;
514502 config .central_conn_params .slave_latency = SLAVE_LATENCY ;
515503 config .central_conn_params .link_sup_to = CONN_SUP_TIMEOUT ;
516504
0 commit comments