Skip to content

Commit ba905e8

Browse files
bluetooth: hrs: change hrm_encode return type to uint16_t
hrm_encode() returned uint8_t, but both places that use it expect a uint16_t (ble_gatts_attr_t.init_len and ble_gatts_hvx_params_t.p_len from the SoftDevice API). In practice the length never goes above 255, so this was not a real bug, just an inconsistency that forced the compiler to silently widen the value. Changing the return type (and the internal len variable) to uint16_t makes everything line up. No functional change. Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
1 parent 8d217db commit ba905e8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • subsys/bluetooth/services/ble_hrs

subsys/bluetooth/services/ble_hrs/hrs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ LOG_MODULE_REGISTER(ble_hrs, CONFIG_BLE_HRS_LOG_LEVEL);
3737
/* RR-Interval bit. */
3838
#define HRM_FLAG_MASK_RR_INTERVAL_INCLUDED BIT(4)
3939

40-
static uint8_t hrm_encode(struct ble_hrs *hrs, uint16_t heart_rate, uint8_t *encoded_buffer)
40+
static uint16_t hrm_encode(struct ble_hrs *hrs, uint16_t heart_rate, uint8_t *encoded_buffer)
4141
{
4242
uint8_t flags = 0;
4343
/* Make space for flags. */
44-
uint8_t len = 1;
44+
uint16_t len = 1;
4545
int i;
4646

4747
/* Set sensor contact related flags. */

0 commit comments

Comments
 (0)