Skip to content

Commit

Permalink
WIFI_COUNTRY configuration key for country-specific Wi-Fi initializat…
Browse files Browse the repository at this point in the history
…ion using the ISO 3166-1 alpha-2 country code
  • Loading branch information
nplanel committed Feb 9, 2024
1 parent 9386f28 commit 56aaf08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion romemul/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static ConfigEntry defaultEntries[MAX_ENTRIES] = {
{"WIFI_SCAN_SECONDS", TYPE_INT, "15"},
{"WIFI_PASSWORD", TYPE_STRING, ""},
{"WIFI_SSID", TYPE_STRING, ""},
{"WIFI_AUTH", TYPE_INT, ""}};
{"WIFI_AUTH", TYPE_INT, ""},
{"WIFI_COUNTRY", TYPE_STRING, ""}};

ConfigData configData;

Expand Down
7 changes: 6 additions & 1 deletion romemul/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ void network_swap_json_data(uint16_t *dest_ptr_word)
void network_init()
{

uint32_t country = CYW43_COUNTRY_WORLDWIDE;
char *country_entry = find_entry("WIFI_COUNTRY")->value;
if (strlen(country_entry) == 2) {
country = CYW43_COUNTRY(country_entry[0], country_entry[1], 0);
}
cyw43_wifi_set_up(&cyw43_state,
CYW43_ITF_STA,
true,
CYW43_COUNTRY_WORLDWIDE);
country);

// Enable the STA mode
cyw43_arch_enable_sta_mode();
Expand Down

0 comments on commit 56aaf08

Please sign in to comment.