extmod/modbluetooth: Fix so it builds in peripheral-only mode.

This commit is contained in:
Jim Mussared
2020-07-20 11:46:55 +10:00
committed by Damien George
parent 43ceadac55
commit 3c7ca2004c
4 changed files with 23 additions and 18 deletions

View File

@@ -96,6 +96,13 @@ STATIC ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_u
}
}
// modbluetooth (and the layers above it) work in BE for addresses, Nimble works in LE.
STATIC void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in) {
for (int i = 0; i < 6; ++i) {
addr_out[i] = addr_in[5 - i];
}
}
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
@@ -123,13 +130,6 @@ STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
return result;
}
// modbluetooth (and the layers above it) work in BE for addresses, Nimble works in LE.
STATIC void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in) {
for (int i = 0; i < 6; ++i) {
addr_out[i] = addr_in[5 - i];
}
}
STATIC ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr) {
ble_addr_t addr_nimble;
addr_nimble.type = addr_type;