Skip to content

Commit db3d124

Browse files
paul-szczepanek-armpan-
authored andcommitted
moved the utility function into the pal since it's only useful below pal
1 parent 03f44e7 commit db3d124

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

features/FEATURE_BLE/ble/BLETypes.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -668,26 +668,6 @@ class phy_set_t {
668668
set_coded(phy_coded);
669669
}
670670

671-
/**
672-
* Create an ALL_PHYS parameter used in LE Set PHY Command
673-
* and LE Set Default PHY Command.
674-
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
675-
*/
676-
static uint8_t all_phys_value(
677-
const phy_set_t& tx_phys,
678-
const phy_set_t& rx_phys
679-
) {
680-
/* if phy set is empty set corresponding all_phys bit to 1 */
681-
uint8_t all_phys = 0;
682-
if (tx_phys.value() == 0) {
683-
all_phys |= 0x01;
684-
}
685-
if (rx_phys.value() == 0) {
686-
all_phys |= 0x02;
687-
}
688-
return all_phys;
689-
}
690-
691671
/** Prefer 1M PHY. */
692672
void set_1m(bool enabled = true) {
693673
if (enabled) {

features/FEATURE_BLE/ble/pal/PalGap.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,27 @@ struct Gap {
802802
}
803803
}
804804

805+
public:
806+
/**
807+
* Create an ALL_PHYS parameter used in LE Set PHY Command
808+
* and LE Set Default PHY Command.
809+
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
810+
*/
811+
static uint8_t create_all_phys_value(
812+
const phy_set_t& tx_phys,
813+
const phy_set_t& rx_phys
814+
) {
815+
/* if phy set is empty set corresponding all_phys bit to 1 */
816+
uint8_t all_phys = 0;
817+
if (tx_phys.value() == 0) {
818+
all_phys |= 0x01;
819+
}
820+
if (rx_phys.value() == 0) {
821+
all_phys |= 0x02;
822+
}
823+
return all_phys;
824+
}
825+
805826
private:
806827
/**
807828
* Callback called when an event is emitted by the LE subsystem.

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ ble_error_t Gap::set_preferred_phys(
343343
const phy_set_t& rx_phys
344344
) {
345345
DmSetDefaultPhy(
346-
phy_set_t::all_phys_value(tx_phys, rx_phys),
346+
create_all_phys_value(tx_phys, rx_phys),
347347
tx_phys.value(),
348348
rx_phys.value()
349349
);
@@ -368,7 +368,7 @@ ble_error_t Gap::set_phy(
368368

369369
DmSetPhy(
370370
connection,
371-
phy_set_t::all_phys_value(tx_phys, rx_phys),
371+
create_all_phys_value(tx_phys, rx_phys),
372372
tx_phys.value(),
373373
rx_phys.value(),
374374
coded_symbol.value()

0 commit comments

Comments
 (0)