more refactoring

This commit is contained in:
Robin Müller 2021-07-16 13:39:50 +02:00
parent d5a342a509
commit 253780d5d4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 18 additions and 12 deletions

View File

@ -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
)

View File

@ -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) {

View File

@ -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)

View File

@ -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 <lwip/netif.h>
#include <stdbool.h>
/* 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****/