Skip to content

Commit

Permalink
[Silabs] Si917: C files converted to C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs committed Mar 19, 2024
1 parent a0ba592 commit 5d0d256
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ source_set("siwx917-common") {
"${silabs_plat_si91x_wifi_dir}/ethernetif.cpp",
"${silabs_plat_si91x_wifi_dir}/lwip_netif.cpp",
"${silabs_plat_si91x_wifi_dir}/wfx_notify.cpp",
"SiWx917/sl_wifi_if.c",
"SiWx917/wfx_rsi_host.c",
"SiWx917/sl_wifi_if.cpp",
"SiWx917/wfx_rsi_host.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || sl_uart_log_output) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@
#include "FreeRTOS.h"
#include "event_groups.h"
#include "sl_board_configuration.h"
#include "sl_net.h"
#include "sl_si91x_host_interface.h"
#include "sl_si91x_types.h"
#include "sl_wifi_callback_framework.h"
#include "sl_wifi_constants.h"
#include "sl_wifi_types.h"
#include "sl_wlan_config.h"
#include "task.h"
#include "wfx_host_events.h"

#if (EXP_BOARD)
#include "rsi_bt_common_apis.h"
Expand Down Expand Up @@ -65,11 +61,17 @@ bool btn0_pressed = false;

// TODO: Confirm that this value works for size and timing
#define WFX_QUEUE_SIZE 10

extern "C" {
#include "sl_net.h"
#include "sl_si91x_host_interface.h"
#include "sl_wifi.h"
#include "sl_wifi_callback_framework.h"
#include "wfx_host_events.h"
#if SLI_SI91X_MCU_INTERFACE
#include "sl_si91x_trng.h"
#define TRNGKEY_SIZE 4
#endif // SLI_SI91X_MCU_INTERFACE
} // extern "C" {

WfxRsi_t wfx_rsi;

Expand Down Expand Up @@ -553,7 +555,7 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
SILABS_LOG("SCAN SSID: %s , ap scan: %s", wfx_rsi.scan_ssid, ap.ssid);
if (strcmp(wfx_rsi.scan_ssid, ap.ssid) == CMP_SUCCESS)
{
ap.security = scan_result->scan_info[x].security_mode;
ap.security = static_cast<wfx_sec_t>(scan_result->scan_info[x].security_mode);
ap.rssi = (-1) * scan_result->scan_info[x].rssi_val;
memcpy(&ap.bssid[0], &scan_result->scan_info[x].bssid[0], BSSID_MAX_STR_LEN);
(*wfx_rsi.scan_cb)(&ap);
Expand All @@ -562,7 +564,7 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
}
else
{
ap.security = scan_result->scan_info[x].security_mode;
ap.security = static_cast<wfx_sec_t>(scan_result->scan_info[x].security_mode);
ap.rssi = (-1) * scan_result->scan_info[x].rssi_val;
memcpy(&ap.bssid[0], &scan_result->scan_info[x].bssid[0], BSSID_MAX_STR_LEN);
(*wfx_rsi.scan_cb)(&ap);
Expand Down Expand Up @@ -597,8 +599,7 @@ static void wfx_rsi_save_ap_info() // translation
{
sl_status_t status = SL_STATUS_OK;
#ifndef EXP_BOARD // TODO: this changes will be reverted back after the SDK team fix the scan API
sl_wifi_scan_configuration_t wifi_scan_configuration = { 0 };
wifi_scan_configuration = default_wifi_scan_configuration;
sl_wifi_scan_configuration_t wifi_scan_configuration = default_wifi_scan_configuration;
#endif
sl_wifi_ssid_t ssid_arg;
ssid_arg.length = strlen(wfx_rsi.sec.ssid);
Expand Down Expand Up @@ -682,10 +683,11 @@ static sl_status_t wfx_rsi_do_join(void)
/* Call rsi connect call with given ssid and password
* And check there is a success
*/
sl_wifi_credential_t cred = { 0 };
cred.type = SL_WIFI_PSK_CREDENTIAL;
sl_wifi_credential_t cred;
memset(&cred, 0, sizeof(sl_wifi_credential_t));
cred.type = SL_WIFI_PSK_CREDENTIAL;
memcpy(cred.psk.value, &wfx_rsi.sec.passkey[0], strlen(wfx_rsi.sec.passkey));
sl_wifi_credential_id_t id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID;
sl_net_credential_id_t id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID;
status = sl_net_set_credential(id, SL_NET_WIFI_PSK, &wfx_rsi.sec.passkey[0], strlen(wfx_rsi.sec.passkey));
if (SL_STATUS_OK != status)
{
Expand Down Expand Up @@ -851,7 +853,9 @@ void ProcessEvent(WfxEvent_t inEvent)
if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED))
{
SILABS_LOG("%s: start SSID scan", __func__);
sl_wifi_scan_configuration_t wifi_scan_configuration = { 0 };
sl_wifi_scan_configuration_t wifi_scan_configuration;
memset(&wifi_scan_configuration, 0, sizeof(sl_wifi_scan_configuration_t));


// TODO: Add scan logic
sl_wifi_advanced_scan_configuration_t advanced_scan_configuration = { 0 };
Expand Down
4 changes: 2 additions & 2 deletions examples/platform/silabs/efr32/rs911x/rs9117.gni
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import("//build_overrides/efr32_sdk.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

rs911x_src_plat = [
"${examples_plat_dir}/rs911x/sl_wifi_if.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
"${examples_plat_dir}/rs911x/sl_wifi_if.cpp",
"${examples_plat_dir}/rs911x/wfx_rsi_host.cpp",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
"${examples_plat_dir}/rs911x/hal/sl_si91x_ncp_utility.c",
"${examples_plat_dir}/rs911x/hal/efx32_ncp_host.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/rs911x/rs911x.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import("${efr32_sdk_build_root}/efr32_sdk.gni")

rs911x_src_plat = [
"${examples_plat_dir}/rs911x/rsi_if.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.cpp",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c",
Expand Down
1 change: 0 additions & 1 deletion examples/platform/silabs/efr32/rs911x/sl_wifi_if.c

This file was deleted.

1 change: 1 addition & 0 deletions examples/platform/silabs/efr32/rs911x/sl_wifi_if.cpp

0 comments on commit 5d0d256

Please sign in to comment.