diff options
-rw-r--r-- | samples/bluetooth/peripheral/prj.conf | 1 | ||||
-rw-r--r-- | samples/bluetooth/peripheral/prj_nble.conf | 1 | ||||
-rw-r--r-- | samples/bluetooth/peripheral/src/main.c | 8 | ||||
-rw-r--r-- | samples/bluetooth/peripheral_hr/prj.conf | 1 | ||||
-rw-r--r-- | samples/bluetooth/peripheral_hr/prj_nble.conf | 1 | ||||
-rw-r--r-- | samples/bluetooth/peripheral_hr/src/main.c | 8 |
6 files changed, 14 insertions, 6 deletions
diff --git a/samples/bluetooth/peripheral/prj.conf b/samples/bluetooth/peripheral/prj.conf index 0cc037fbd..98d6d2ff0 100644 --- a/samples/bluetooth/peripheral/prj.conf +++ b/samples/bluetooth/peripheral/prj.conf @@ -1,4 +1,3 @@ -CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_BLUETOOTH=y CONFIG_BLUETOOTH_LE=y CONFIG_BLUETOOTH_DEBUG=y diff --git a/samples/bluetooth/peripheral/prj_nble.conf b/samples/bluetooth/peripheral/prj_nble.conf index ef0af4e30..ba9f2e8b1 100644 --- a/samples/bluetooth/peripheral/prj_nble.conf +++ b/samples/bluetooth/peripheral/prj_nble.conf @@ -1,4 +1,3 @@ -CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NBLE=y CONFIG_ARC_INIT=n CONFIG_BLUETOOTH_DEBUG=y diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 21c5e5630..b13b7ad15 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -73,6 +73,7 @@ static int read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr, static struct bt_gatt_ccc_cfg blvl_ccc_cfg[CONFIG_BLUETOOTH_MAX_PAIRED] = {}; static uint8_t simulate_blvl = 0; static uint8_t battery = 100; +static uint8_t heartrate = 90; static void blvl_ccc_cfg_changed(uint16_t value) { @@ -504,8 +505,13 @@ void main(void) /* Heartrate measurements simulation */ if (simulate_hrm) { + heartrate++; + if (heartrate == 160) { + heartrate = 90; + } + hrm[0] = 0x06; /* uint8, sensor contact */ - hrm[1] = 90 + (sys_rand32_get() % 20); + hrm[1] = heartrate; bt_gatt_notify(NULL, &hrs_attrs[2], &hrm, sizeof(hrm)); } diff --git a/samples/bluetooth/peripheral_hr/prj.conf b/samples/bluetooth/peripheral_hr/prj.conf index 8fef00b1d..9d1fa5d42 100644 --- a/samples/bluetooth/peripheral_hr/prj.conf +++ b/samples/bluetooth/peripheral_hr/prj.conf @@ -1,4 +1,3 @@ -CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_BLUETOOTH=y CONFIG_BLUETOOTH_LE=y CONFIG_BLUETOOTH_DEBUG=y diff --git a/samples/bluetooth/peripheral_hr/prj_nble.conf b/samples/bluetooth/peripheral_hr/prj_nble.conf index ef0af4e30..ba9f2e8b1 100644 --- a/samples/bluetooth/peripheral_hr/prj_nble.conf +++ b/samples/bluetooth/peripheral_hr/prj_nble.conf @@ -1,4 +1,3 @@ -CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NBLE=y CONFIG_ARC_INIT=n CONFIG_BLUETOOTH_DEBUG=y diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index f310ffdd9..040408e50 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -75,6 +75,7 @@ static int read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr, static struct bt_gatt_ccc_cfg blvl_ccc_cfg[CONFIG_BLUETOOTH_MAX_PAIRED] = {}; static uint8_t simulate_blvl; static uint8_t battery = 100; +static uint8_t heartrate = 90; static void blvl_ccc_cfg_changed(uint16_t value) { @@ -262,8 +263,13 @@ void main(void) /* Heartrate measurements simulation */ if (simulate_hrm) { + heartrate++; + if (heartrate == 160) { + heartrate = 90; + } + hrm[0] = 0x06; /* uint8, sensor contact */ - hrm[1] = 90 + (sys_rand32_get() % 20); + hrm[1] = heartrate; bt_gatt_notify(default_conn, &hrs_attrs[2], &hrm, sizeof(hrm)); |