Skip to content

Commit 00ffeac

Browse files
committed
wiseconnect: BLE SDK files
Origin: Silicon Labs WiseConnect SDK License: Zlib URL: https://github.com/siliconlabs/wiseconnect Commit: 984fbd4f333c0cede0e24b047de969d2fdfbabf7 Version: v3.5.1 Purpose: Add BT/BLE Power Manager support for SiWx91x Signed-off-by: Mohamed Irfan <[email protected]>
1 parent 08811f1 commit 00ffeac

File tree

1 file changed

+84
-0
lines changed
  • wiseconnect/components/device/silabs/si91x/wireless/ble/src

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/***************************************************************************/ /**
2+
* @file
3+
* @brief
4+
*******************************************************************************
5+
* # License
6+
* <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b>
7+
*******************************************************************************
8+
*
9+
* SPDX-License-Identifier: Zlib
10+
*
11+
* The licensor of this software is Silicon Laboratories Inc.
12+
*
13+
* This software is provided 'as-is', without any express or implied
14+
* warranty. In no event will the authors be held liable for any damages
15+
* arising from the use of this software.
16+
*
17+
* Permission is granted to anyone to use this software for any purpose,
18+
* including commercial applications, and to alter it and redistribute it
19+
* freely, subject to the following restrictions:
20+
*
21+
* 1. The origin of this software must not be misrepresented; you must not
22+
* claim that you wrote the original software. If you use this software
23+
* in a product, an acknowledgment in the product documentation would be
24+
* appreciated but is not required.
25+
* 2. Altered source versions must be plainly marked as such, and must not be
26+
* misrepresented as being the original software.
27+
* 3. This notice may not be removed or altered from any source distribution.
28+
*
29+
******************************************************************************/
30+
#include "sl_si91x_ble.h"
31+
#include "sl_rsi_utility.h"
32+
33+
extern bool device_initialized;
34+
35+
/*=======================================================================*/
36+
37+
sl_status_t sl_si91x_bt_set_performance_profile(const sl_bt_performance_profile_t *profile)
38+
{
39+
sl_status_t status;
40+
sl_si91x_performance_profile_t selected_coex_profile_mode = { 0 };
41+
sl_si91x_performance_profile_t current_coex_profile_mode = { 0 };
42+
sl_bt_performance_profile_t current_bt_profile_mode = { 0 };
43+
44+
if (!device_initialized) {
45+
return SL_STATUS_NOT_INITIALIZED;
46+
}
47+
SL_WIFI_ARGS_CHECK_NULL_POINTER(profile);
48+
49+
// Take backup of current bt profile
50+
sli_get_bt_current_performance_profile(&current_bt_profile_mode);
51+
sli_get_coex_performance_profile(&current_coex_profile_mode);
52+
// Compute selected coex profile
53+
// Check if current coex profile and selected coex profile are the same
54+
sli_save_bt_current_performance_profile(profile);
55+
sli_get_coex_performance_profile(&selected_coex_profile_mode);
56+
57+
if (selected_coex_profile_mode == current_coex_profile_mode) {
58+
return SL_STATUS_OK;
59+
}
60+
61+
status = sli_si91x_send_power_save_request(NULL, &current_bt_profile_mode);
62+
if (status != SL_STATUS_OK) {
63+
sli_save_bt_current_performance_profile(&current_bt_profile_mode);
64+
return status;
65+
}
66+
67+
// Set device_initialized as false since RAM of module will be not retained
68+
// in ULTRA_POWER_SAVE and module needs to be started from init again
69+
if (selected_coex_profile_mode == DEEP_SLEEP_WITHOUT_RAM_RETENTION) {
70+
device_initialized = false;
71+
sli_reset_coex_current_performance_profile();
72+
}
73+
return SL_STATUS_OK;
74+
}
75+
76+
sl_status_t sl_si91x_bt_get_performance_profile(sl_bt_performance_profile_t *profile)
77+
{
78+
if (!device_initialized) {
79+
return SL_STATUS_NOT_INITIALIZED;
80+
}
81+
82+
sli_get_bt_current_performance_profile(profile);
83+
return SL_STATUS_OK;
84+
}

0 commit comments

Comments
 (0)