48
48
#include "ble_client.h"
49
49
#include "platform.h"
50
50
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
-
65
51
/* Advertising parameters */
66
52
#define BLE_GAP_ADV_TYPE_ADV_IND 0x00 /**< Connectable undirected. */
67
53
#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
496
482
BleStatus ble_client_gap_set_enable_config (const char * name ,
497
483
const ble_addr_t * bda ,
498
484
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 )
500
488
{
501
489
struct ble_wr_config config ;
502
490
BleStatus status ;
@@ -505,12 +493,12 @@ BleStatus ble_client_gap_set_enable_config(const char *name,
505
493
config .p_name = (uint8_t * )name ;
506
494
config .appearance = appearance ;
507
495
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 ;
510
498
config .peripheral_conn_params .slave_latency = SLAVE_LATENCY ;
511
499
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 ;
514
502
config .central_conn_params .slave_latency = SLAVE_LATENCY ;
515
503
config .central_conn_params .link_sup_to = CONN_SUP_TIMEOUT ;
516
504
0 commit comments