2023-11-22 20:10:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-28 17:26:02 -04:00
|
|
|
#include <AP_HAL/AP_HAL_Boards.h>
|
2023-11-22 19:14:56 -04:00
|
|
|
|
2023-11-22 20:10:55 -04:00
|
|
|
#ifdef HAL_PERIPH_ENABLE_NETWORKING
|
|
|
|
|
2023-11-28 17:26:02 -04:00
|
|
|
#include <AP_Networking/AP_Networking.h>
|
|
|
|
|
2023-11-22 20:10:55 -04:00
|
|
|
#ifndef HAL_PERIPH_NETWORK_NUM_PASSTHRU
|
|
|
|
#define HAL_PERIPH_NETWORK_NUM_PASSTHRU 2
|
|
|
|
#endif
|
|
|
|
|
2024-01-11 00:02:13 -04:00
|
|
|
#ifndef AP_PERIPH_NET_PPP_PORT_DEFAULT
|
|
|
|
#define AP_PERIPH_NET_PPP_PORT_DEFAULT -1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_PERIPH_NET_PPP_BAUD_DEFAULT
|
|
|
|
#define AP_PERIPH_NET_PPP_BAUD_DEFAULT 12500000
|
|
|
|
#endif
|
|
|
|
|
2023-11-22 20:10:55 -04:00
|
|
|
class Networking_Periph {
|
|
|
|
public:
|
|
|
|
Networking_Periph() {
|
|
|
|
AP_Param::setup_object_defaults(this, var_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
void init();
|
|
|
|
void update();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
#if HAL_PERIPH_NETWORK_NUM_PASSTHRU > 0
|
|
|
|
class Passthru {
|
|
|
|
public:
|
|
|
|
friend class Networking_Periph;
|
|
|
|
|
|
|
|
CLASS_NO_COPY(Passthru);
|
|
|
|
|
|
|
|
Passthru() {
|
|
|
|
AP_Param::setup_object_defaults(this, var_info);
|
|
|
|
}
|
|
|
|
|
2023-11-22 19:14:56 -04:00
|
|
|
void init();
|
|
|
|
void update();
|
|
|
|
|
2023-11-22 20:10:55 -04:00
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
private:
|
|
|
|
AP_Int8 enabled;
|
|
|
|
AP_Int8 ep1;
|
|
|
|
AP_Int8 ep2;
|
|
|
|
AP_Int32 baud1;
|
|
|
|
AP_Int32 baud2;
|
|
|
|
AP_Int32 options1;
|
|
|
|
AP_Int32 options2;
|
|
|
|
|
|
|
|
AP_HAL::UARTDriver *port1;
|
|
|
|
AP_HAL::UARTDriver *port2;
|
|
|
|
} passthru[HAL_PERIPH_NETWORK_NUM_PASSTHRU];
|
|
|
|
#endif // HAL_PERIPH_NETWORK_NUM_PASSTHRU
|
|
|
|
|
|
|
|
AP_Networking networking_lib;
|
2024-01-14 22:09:34 -04:00
|
|
|
bool got_addresses;
|
2023-11-22 20:10:55 -04:00
|
|
|
|
2024-01-11 00:02:13 -04:00
|
|
|
#if AP_NETWORKING_BACKEND_PPP
|
|
|
|
AP_Int8 ppp_port;
|
|
|
|
AP_Int32 ppp_baud;
|
|
|
|
#endif
|
|
|
|
};
|
2023-11-22 20:10:55 -04:00
|
|
|
|
2024-01-11 00:02:13 -04:00
|
|
|
#endif // HAL_PERIPH_ENABLE_NETWORKING
|