Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/AP_Periph/serial_options.cpp
Views: 1798
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/14/*15serial options support, for serial over DroneCAN16*/1718#include "AP_Periph.h"1920#ifdef HAL_PERIPH_ENABLE_SERIAL_OPTIONS2122#include "serial_options.h"23#include <AP_SerialManager/AP_SerialManager_config.h>2425extern const AP_HAL::HAL &hal;2627const AP_Param::GroupInfo SerialOptions::var_info[] {2829#if HAL_HAVE_SERIAL030// @Group: 0_31// @Path: serial_options_dev.cpp32AP_SUBGROUPINFO(devs[0], "0_", 1, SerialOptions, SerialOptionsDev),33#endif3435#if HAL_HAVE_SERIAL136// @Group: 1_37// @Path: serial_options_dev.cpp38AP_SUBGROUPINFO(devs[1], "1_", 2, SerialOptions, SerialOptionsDev),39#endif4041#if HAL_HAVE_SERIAL242// @Group: 2_43// @Path: serial_options_dev.cpp44AP_SUBGROUPINFO(devs[2], "2_", 3, SerialOptions, SerialOptionsDev),45#endif4647#if HAL_HAVE_SERIAL348// @Group: 3_49// @Path: serial_options_dev.cpp50AP_SUBGROUPINFO(devs[3], "3_", 4, SerialOptions, SerialOptionsDev),51#endif5253#if HAL_HAVE_SERIAL454// @Group: 4_55// @Path: serial_options_dev.cpp56AP_SUBGROUPINFO(devs[4], "4_", 5, SerialOptions, SerialOptionsDev),57#endif5859#if HAL_HAVE_SERIAL560// @Group: 5_61// @Path: serial_options_dev.cpp62AP_SUBGROUPINFO(devs[5], "5_", 6, SerialOptions, SerialOptionsDev),63#endif6465#if HAL_HAVE_SERIAL666// @Group: 6_67// @Path: serial_options_dev.cpp68AP_SUBGROUPINFO(devs[6], "6_", 7, SerialOptions, SerialOptionsDev),69#endif7071#if HAL_HAVE_SERIAL772// @Group: 7_73// @Path: serial_options_dev.cpp74AP_SUBGROUPINFO(devs[7], "7_", 8, SerialOptions, SerialOptionsDev),75#endif7677#if HAL_HAVE_SERIAL878// @Group: 8_79// @Path: serial_options_dev.cpp80AP_SUBGROUPINFO(devs[8], "8_", 9, SerialOptions, SerialOptionsDev),81#endif8283#if HAL_HAVE_SERIAL984// @Group: 9_85// @Path: serial_options_dev.cpp86AP_SUBGROUPINFO(devs[9], "9_", 10, SerialOptions, SerialOptionsDev),87#endif8889AP_GROUPEND90};9192SerialOptions::SerialOptions(void)93{94AP_Param::setup_object_defaults(this, var_info);95}9697void SerialOptions::init(void)98{99for (uint8_t i=0; i<ARRAY_SIZE(devs); i++) {100auto *uart = hal.serial(i);101if (uart != nullptr) {102auto &d = devs[i];103uart->set_options(d.options);104uart->set_flow_control(AP_HAL::UARTDriver::flow_control(d.rtscts.get()));105}106}107}108109#endif // HAL_PERIPH_ENABLE_SERIAL_OPTIONS110111112