15
15
* limitations under the License.
16
16
*/
17
17
18
+ /*
19
+ * This file implements the interface to the wifi sdk
20
+ */
21
+
18
22
#include < stdio.h>
19
23
#include < stdlib.h>
20
24
#include < string.h>
23
27
#include " sl_matter_wifi_config.h"
24
28
#endif // SL_MATTER_GN_BUILD
25
29
30
+ #include " FreeRTOS.h"
31
+ #include " ble_config.h"
32
+ #include " dhcp_client.h"
33
+ #include " event_groups.h"
34
+ #include " sl_board_configuration.h"
26
35
#include " sl_status.h"
36
+ #include " task.h"
37
+ #include " wfx_host_events.h"
38
+ #include " wfx_rsi.h"
27
39
#include < app/icd/server/ICDServerConfig.h>
28
40
#include < inet/IPAddress.h>
29
41
#include < lib/support/logging/CHIPLogging.h>
30
42
31
- #include " FreeRTOS.h"
32
- #include " event_groups.h"
33
- #include " sl_board_configuration.h"
34
43
extern " C" {
44
+ #include " sl_net.h"
45
+ #include " sl_si91x_driver.h"
46
+ #include " sl_si91x_host_interface.h"
35
47
#include " sl_si91x_types.h"
48
+ #include " sl_wifi.h"
49
+ #include " sl_wifi_callback_framework.h"
36
50
#include " sl_wifi_constants.h"
37
51
#include " sl_wifi_types.h"
38
52
#include " sl_wlan_config.h"
53
+ #include " wfx_host_events.h"
54
+ #if SL_MBEDTLS_USE_TINYCRYPT
55
+ #include " sl_si91x_constants.h"
56
+ #include " sl_si91x_trng.h"
57
+ #endif // SL_MBEDTLS_USE_TINYCRYPT
39
58
}
40
- #include " task.h"
41
59
42
60
#if (EXP_BOARD)
43
61
#include " rsi_bt_common_apis.h"
44
62
#endif
45
63
46
- #include " ble_config.h"
47
-
48
64
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
49
65
#include " rsi_rom_power_save.h"
50
66
#include " sl_si91x_button_pin_config.h"
51
- #if DISPLAY_ENABLED
52
- #include " sl_memlcd.h"
53
- #endif // DISPLAY_ENABLED
54
- extern " C" {
55
- #include " sl_si91x_driver.h"
56
- #include " sl_si91x_m4_ps.h"
57
- }
67
+ #include " sl_si91x_power_manager.h"
58
68
59
69
namespace {
60
70
// TODO: should be removed once we are getting the press interrupt for button 0 with sleep
@@ -67,9 +77,6 @@ bool ps_requirement_added = false;
67
77
} // namespace
68
78
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
69
79
70
- #include " dhcp_client.h"
71
- #include " wfx_host_events.h"
72
- #include " wfx_rsi.h"
73
80
#define ADV_SCAN_THRESHOLD -40
74
81
#define ADV_RSSI_TOLERANCE_THRESHOLD 5
75
82
#define ADV_ACTIVE_SCAN_DURATION 15
@@ -79,17 +86,9 @@ bool ps_requirement_added = false;
79
86
80
87
// TODO: Confirm that this value works for size and timing
81
88
#define WFX_QUEUE_SIZE 10
82
- extern " C" {
83
- #include " sl_net.h"
84
- #include " sl_si91x_host_interface.h"
85
- #include " sl_wifi.h"
86
- #include " sl_wifi_callback_framework.h"
87
- #include " wfx_host_events.h"
88
- #if SL_MBEDTLS_USE_TINYCRYPT
89
- #include " sl_si91x_constants.h"
90
- #include " sl_si91x_trng.h"
91
- #endif // SL_MBEDTLS_USE_TINYCRYPT
92
- }
89
+
90
+ // TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
91
+ #define WIFI_SCAN_TIMEOUT_TICK 10000
93
92
94
93
WfxRsi_t wfx_rsi;
95
94
@@ -109,20 +108,9 @@ bool is_wifi_disconnection_event = false;
109
108
uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS;
110
109
volatile bool scan_results_complete = false ;
111
110
volatile bool bg_scan_results_complete = false ;
112
-
113
- // TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
114
- #define WIFI_SCAN_TIMEOUT_TICK 10000
115
-
116
111
extern osSemaphoreId_t sl_rs_ble_init_sem;
117
-
118
- /*
119
- * This file implements the interface to the wifi sdk
120
- */
121
-
122
112
static wfx_wifi_scan_ext_t temp_reset;
123
-
124
113
volatile sl_status_t callback_status = SL_STATUS_OK;
125
-
126
114
// Scan semaphore
127
115
static osSemaphoreId_t sScanSemaphore ;
128
116
// DHCP Poll timer
@@ -319,28 +307,6 @@ void sl_si91x_invoke_btn_press_event()
319
307
}
320
308
#endif // ENABLE_CHIP_SHELL
321
309
}
322
-
323
- /* *****************************************************************
324
- * @fn sl_app_sleep_ready()
325
- * @brief
326
- * Called from the supress ticks from tickless to check if it
327
- * is ok to go to sleep
328
- * @param[in] None
329
- * @return
330
- * None
331
- *********************************************************************/
332
- uint32_t sl_app_sleep_ready ()
333
- {
334
- if (wfx_rsi.dev_state & WFX_RSI_ST_SLEEP_READY)
335
- {
336
- #if DISPLAY_ENABLED
337
- // Powering down the LCD
338
- sl_memlcd_power_on (NULL , false );
339
- #endif /* DISPLAY_ENABLED */
340
- return true ;
341
- }
342
- return false ;
343
- }
344
310
#endif // SLI_SI91X_MCU_INTERFACE
345
311
346
312
/* *****************************************************************
@@ -370,14 +336,7 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
370
336
ChipLogError (DeviceLayer, " sl_wifi_set_performance_profile failed: 0x%lx" , static_cast <uint32_t >(status));
371
337
return status;
372
338
}
373
- if (sl_si91x_wifi_state == HIGH_PERFORMANCE)
374
- {
375
- wfx_rsi.dev_state &= ~(WFX_RSI_ST_SLEEP_READY);
376
- }
377
- else
378
- {
379
- wfx_rsi.dev_state |= WFX_RSI_ST_SLEEP_READY;
380
- }
339
+
381
340
return status;
382
341
}
383
342
#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */
0 commit comments