AP_Periph: added support for PPP gatewate peripheral

This commit is contained in:
Andrew Tridgell 2024-01-11 15:02:13 +11:00 committed by Tom Pittenger
parent 458d8cad4e
commit 44bc523db8
3 changed files with 38 additions and 6 deletions

View File

@ -100,16 +100,16 @@ void AP_Periph_FW::init()
can_start(); can_start();
#ifdef HAL_PERIPH_ENABLE_NETWORKING
networking_periph.init();
#endif
#if HAL_GCS_ENABLED #if HAL_GCS_ENABLED
stm32_watchdog_pat(); stm32_watchdog_pat();
gcs().init(); gcs().init();
#endif #endif
serial_manager.init(); serial_manager.init();
#ifdef HAL_PERIPH_ENABLE_NETWORKING
networking_periph.init();
#endif
#if HAL_GCS_ENABLED #if HAL_GCS_ENABLED
gcs().setup_console(); gcs().setup_console();
gcs().setup_uarts(); gcs().setup_uarts();

View File

@ -137,12 +137,32 @@ const AP_Param::GroupInfo Networking_Periph::var_info[] {
AP_SUBGROUPINFO(passthru[8], "PASS9_", 19, Networking_Periph, Passthru), AP_SUBGROUPINFO(passthru[8], "PASS9_", 19, Networking_Periph, Passthru),
#endif #endif
#if AP_NETWORKING_BACKEND_PPP
// @Param: PPP_PORT
// @DisplayName: PPP serial port
// @Description: PPP serial port
// @Range: -1 10
AP_GROUPINFO("PPP_PORT", 20, Networking_Periph, ppp_port, AP_PERIPH_NET_PPP_PORT_DEFAULT),
// @Param: PPP_BAUD
// @DisplayName: PPP serial baudrate
// @Description: PPP serial baudrate
// @CopyFieldsFrom: SERIAL1_BAUD
AP_GROUPINFO("PPP_BAUD", 21, Networking_Periph, ppp_baud, AP_PERIPH_NET_PPP_BAUD_DEFAULT),
#endif
AP_GROUPEND AP_GROUPEND
}; };
void Networking_Periph::init(void) void Networking_Periph::init(void)
{ {
#if AP_NETWORKING_BACKEND_PPP
if (ppp_port >= 0) {
AP::serialmanager().set_protocol_and_baud(ppp_port, AP_SerialManager::SerialProtocol_PPP, ppp_baud.get());
}
#endif
networking_lib.init(); networking_lib.init();
#if HAL_PERIPH_NETWORK_NUM_PASSTHRU > 0 #if HAL_PERIPH_NETWORK_NUM_PASSTHRU > 0

View File

@ -10,6 +10,14 @@
#define HAL_PERIPH_NETWORK_NUM_PASSTHRU 2 #define HAL_PERIPH_NETWORK_NUM_PASSTHRU 2
#endif #endif
#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
class Networking_Periph { class Networking_Periph {
public: public:
Networking_Periph() { Networking_Periph() {
@ -54,7 +62,11 @@ private:
#endif // HAL_PERIPH_NETWORK_NUM_PASSTHRU #endif // HAL_PERIPH_NETWORK_NUM_PASSTHRU
AP_Networking networking_lib; AP_Networking networking_lib;
#if AP_NETWORKING_BACKEND_PPP
AP_Int8 ppp_port;
AP_Int32 ppp_baud;
#endif
}; };
#endif // HAL_PERIPH_ENABLE_BATTERY_BALANCE #endif // HAL_PERIPH_ENABLE_NETWORKING