mirror of https://github.com/ARMmbed/mbed-os.git
moved the utility function into the pal since it's only useful below pal
parent
03f44e7a29
commit
db3d124516
|
|
@ -668,26 +668,6 @@ public:
|
||||||
set_coded(phy_coded);
|
set_coded(phy_coded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an ALL_PHYS parameter used in LE Set PHY Command
|
|
||||||
* and LE Set Default PHY Command.
|
|
||||||
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
|
|
||||||
*/
|
|
||||||
static uint8_t all_phys_value(
|
|
||||||
const phy_set_t& tx_phys,
|
|
||||||
const phy_set_t& rx_phys
|
|
||||||
) {
|
|
||||||
/* if phy set is empty set corresponding all_phys bit to 1 */
|
|
||||||
uint8_t all_phys = 0;
|
|
||||||
if (tx_phys.value() == 0) {
|
|
||||||
all_phys |= 0x01;
|
|
||||||
}
|
|
||||||
if (rx_phys.value() == 0) {
|
|
||||||
all_phys |= 0x02;
|
|
||||||
}
|
|
||||||
return all_phys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Prefer 1M PHY. */
|
/** Prefer 1M PHY. */
|
||||||
void set_1m(bool enabled = true) {
|
void set_1m(bool enabled = true) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|
|
||||||
|
|
@ -802,6 +802,27 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Create an ALL_PHYS parameter used in LE Set PHY Command
|
||||||
|
* and LE Set Default PHY Command.
|
||||||
|
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
|
||||||
|
*/
|
||||||
|
static uint8_t create_all_phys_value(
|
||||||
|
const phy_set_t& tx_phys,
|
||||||
|
const phy_set_t& rx_phys
|
||||||
|
) {
|
||||||
|
/* if phy set is empty set corresponding all_phys bit to 1 */
|
||||||
|
uint8_t all_phys = 0;
|
||||||
|
if (tx_phys.value() == 0) {
|
||||||
|
all_phys |= 0x01;
|
||||||
|
}
|
||||||
|
if (rx_phys.value() == 0) {
|
||||||
|
all_phys |= 0x02;
|
||||||
|
}
|
||||||
|
return all_phys;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Callback called when an event is emitted by the LE subsystem.
|
* Callback called when an event is emitted by the LE subsystem.
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ ble_error_t Gap::set_preferred_phys(
|
||||||
const phy_set_t& rx_phys
|
const phy_set_t& rx_phys
|
||||||
) {
|
) {
|
||||||
DmSetDefaultPhy(
|
DmSetDefaultPhy(
|
||||||
phy_set_t::all_phys_value(tx_phys, rx_phys),
|
create_all_phys_value(tx_phys, rx_phys),
|
||||||
tx_phys.value(),
|
tx_phys.value(),
|
||||||
rx_phys.value()
|
rx_phys.value()
|
||||||
);
|
);
|
||||||
|
|
@ -368,7 +368,7 @@ ble_error_t Gap::set_phy(
|
||||||
|
|
||||||
DmSetPhy(
|
DmSetPhy(
|
||||||
connection,
|
connection,
|
||||||
phy_set_t::all_phys_value(tx_phys, rx_phys),
|
create_all_phys_value(tx_phys, rx_phys),
|
||||||
tx_phys.value(),
|
tx_phys.value(),
|
||||||
rx_phys.value(),
|
rx_phys.value(),
|
||||||
coded_symbol.value()
|
coded_symbol.value()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue