extmod/modbluetooh_nimble: Fix UUID conversion for 16 and 32 bit values.

This commit is contained in:
Jim Mussared 2019-11-13 16:59:23 +11:00 committed by Damien George
parent 2ae755d9e1
commit 438c0dc2a4
1 changed files with 4 additions and 4 deletions

View File

@ -117,14 +117,14 @@ STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
case BLE_UUID_TYPE_16:
result.type = MP_BLUETOOTH_UUID_TYPE_16;
result.data[0] = uuid->u16.value & 0xff;
result.data[1] = (uuid->u16.value << 8) & 0xff;
result.data[1] = (uuid->u16.value >> 8) & 0xff;
break;
case BLE_UUID_TYPE_32:
result.type = MP_BLUETOOTH_UUID_TYPE_32;
result.data[0] = uuid->u32.value & 0xff;
result.data[1] = (uuid->u32.value << 8) & 0xff;
result.data[2] = (uuid->u32.value << 16) & 0xff;
result.data[3] = (uuid->u32.value << 24) & 0xff;
result.data[1] = (uuid->u32.value >> 8) & 0xff;
result.data[2] = (uuid->u32.value >> 16) & 0xff;
result.data[3] = (uuid->u32.value >> 24) & 0xff;
break;
case BLE_UUID_TYPE_128:
result.type = MP_BLUETOOTH_UUID_TYPE_128;