Skip to content

Commit

Permalink
RS14100: Basic WiFi support (STA only)
Browse files Browse the repository at this point in the history
CL: RS14100: Basic WiFi support (STA only)

PUBLISHED_FROM=d8cf592b4ec863c839d92672311b6c3d6dc42e9d
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Apr 17, 2019
1 parent a4ae820 commit 76d87db
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/stm32/stm32_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "common/cs_dbg.h"

#include "mgos_lwip.h"
#include "mgos_net.h"
#include "mgos_net_hal.h"
#include "mgos_sys_config.h"
Expand All @@ -38,11 +39,8 @@ static struct netif *s_eth_netif = NULL;

bool mgos_eth_dev_get_ip_info(int if_instance,
struct mgos_net_ip_info *ip_info) {
if (s_eth_netif == NULL || if_instance != 0) return false;
ip_info->ip.sin_addr.s_addr = ip_addr_get_ip4_u32(&s_eth_netif->ip_addr);
ip_info->netmask.sin_addr.s_addr = ip_addr_get_ip4_u32(&s_eth_netif->netmask);
ip_info->gw.sin_addr.s_addr = ip_addr_get_ip4_u32(&s_eth_netif->gw);
return true;
if (if_instance != 0) return false;
return mgos_lwip_if_get_ip_info(s_eth_netif, ip_info);
}

bool mgos_ethernet_init(void) {
Expand Down Expand Up @@ -96,23 +94,6 @@ bool mgos_ethernet_init(void) {
goto clean;
}

if (mgos_sys_config_get_eth_ip() != NULL) {
if (!ip4addr_aton(mgos_sys_config_get_eth_ip(), &ip)) {
LOG(LL_ERROR, ("Invalid eth.ip!"));
goto clean;
}
if (mgos_sys_config_get_eth_netmask() == NULL ||
!ip4addr_aton(mgos_sys_config_get_eth_netmask(), &netmask)) {
LOG(LL_ERROR, ("Invalid eth.netmask!"));
goto clean;
}
if (mgos_sys_config_get_eth_gw() != NULL &&
!ip4addr_aton(mgos_sys_config_get_eth_gw(), &gw)) {
LOG(LL_ERROR, ("Invalid eth.gw!"));
goto clean;
}
}

struct netif *netif = (struct netif *) calloc(1, sizeof(*netif));
if (netif_add(netif, &ip, &netmask, &gw, &opts, stm32_eth_netif_init,
ethernet_input) == NULL) {
Expand Down

0 comments on commit 76d87db

Please sign in to comment.