diff --git a/stm32h7/networking/CMakeLists.txt b/stm32h7/networking/CMakeLists.txt index 676adb8..8ce157d 100644 --- a/stm32h7/networking/CMakeLists.txt +++ b/stm32h7/networking/CMakeLists.txt @@ -1,7 +1,7 @@ # These are part of the RTEMS BSP for RTEMS if(FSFW_OSAL MATCHES freertos) target_sources(${TARGET_NAME} PRIVATE - app_ethernet.c + app_ethernet.cpp ethernetif.c ) endif() @@ -11,4 +11,5 @@ target_sources(${TARGET_NAME} PRIVATE TmTcLwIpUdpBridge.cpp networking.cpp app_dhcp.cpp + ) diff --git a/stm32h7/networking/UdpTcLwIpPollingTask.cpp b/stm32h7/networking/UdpTcLwIpPollingTask.cpp index 8ec0472..8aec5f9 100644 --- a/stm32h7/networking/UdpTcLwIpPollingTask.cpp +++ b/stm32h7/networking/UdpTcLwIpPollingTask.cpp @@ -44,7 +44,7 @@ ReturnValue_t UdpTcLwIpPollingTask::performOperation(uint8_t operationCode) { sys_check_timeouts(); #if LWIP_NETIF_LINK_CALLBACK == 1 - ethernet_link_periodic_handle(gnetif); + networking::ethernetLinkPeriodicHandle(gnetif); #endif if(udpBridge != nullptr) { diff --git a/stm32h7/networking/app_ethernet.c b/stm32h7/networking/app_ethernet.cpp similarity index 90% rename from stm32h7/networking/app_ethernet.c rename to stm32h7/networking/app_ethernet.cpp index a359e78..86c120c 100644 --- a/stm32h7/networking/app_ethernet.c +++ b/stm32h7/networking/app_ethernet.cpp @@ -2,6 +2,7 @@ #include "app_ethernet.h" #include "ethernetif.h" #include "udp_config.h" +#include "networking.h" #if LWIP_DHCP #include "app_dhcp.h" @@ -28,16 +29,16 @@ void handle_status_change(struct netif* netif, bool link_up); * @param netif: the network interface * @retval None */ -void ethernet_link_status_updated(struct netif *netif) +void networking::ethernetLinkStatusUpdated(struct netif *netif) { if (netif_is_link_up(netif)) { - set_eth_cable_connected(true); + networking::setEthCableConnected(true); handle_status_change(netif, true); } else { - set_eth_cable_connected(false); + networking::setEthCableConnected(false); handle_status_change(netif, false); } } @@ -79,7 +80,7 @@ void handle_status_change(struct netif* netif, bool link_up) { * @param netif * @retval None */ -void ethernet_link_periodic_handle(struct netif *netif) +void networking::ethernetLinkPeriodicHandle(struct netif *netif) { /* Ethernet Link every 100ms */ if (HAL_GetTick() - ethernetLinkTimer >= 100) diff --git a/stm32h7/networking/app_ethernet.h b/stm32h7/networking/app_ethernet.h index 4701e10..f0cd403 100644 --- a/stm32h7/networking/app_ethernet.h +++ b/stm32h7/networking/app_ethernet.h @@ -44,8 +44,8 @@ */ /* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __APP_ETHERNET_H -#define __APP_ETHERNET_H +#ifndef EXAMPLE_COMMON_APP_ETHERNET_H +#define EXAMPLE_COMMON_APP_ETHERNET_H #ifdef __cplusplus extern "C" { @@ -53,21 +53,25 @@ /* Includes ------------------------------------------------------------------*/ #include -#include + /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ -void ethernet_link_status_updated(struct netif *netif); -void ethernet_link_periodic_handle(struct netif *netif); +namespace networking { + +void ethernetLinkStatusUpdated(struct netif *netif); +void ethernetLinkPeriodicHandle(struct netif *netif); + +} #ifdef __cplusplus } #endif -#endif /* __APP_ETHERNET_H */ +#endif /* EXAMPLE_COMMON_APP_ETHERNET_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/