50 for (i = 0; i < input_rc_s::RC_INPUT_MAX_CHANNELS; ++i) {
57 PX4_WARN(
"error: advertise failed");
67 PX4_ERR(
"Open SBUS input %s failed, status %d \n",
_device,
73 struct termios2 tio { };
84 tio.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL
86 tio.c_iflag |= (INPCK | IGNPAR);
87 tio.c_oflag &= ~OPOST;
88 tio.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
89 tio.c_cflag &= ~(CSIZE | CRTSCTS | PARODD | CBAUD);
93 tio.c_cflag |= (CS8 | CSTOPB | CLOCAL | PARENB | BOTHER | CREAD);
94 tio.c_ispeed = 100000;
95 tio.c_ospeed = 100000;
112 PX4_INFO(
"Device %s , channels: %d \n", device, channels);
117 PX4_WARN(
"error: RC initialization failed");
243 PX4_ERR(
"%s", reason);
246 PX4_INFO(
"Usage: linux_sbus {start|stop|status} -d <device> -c <channel>");
256 char device[30] =
"/dev/ttyS1";
265 for (start = 0; start < argc; ++
start) {
266 if (0 == strcmp(argv[start],
"start")) {
271 if (0 == strcmp(argv[start],
"stop")) {
276 if (0 == strcmp(argv[start],
"status")) {
281 if (0 == strcmp(argv[start],
"-d")) {
282 if (argc > (start + 1)) {
283 strcpy(device, argv[start + 1]);
289 if (0 == strcmp(argv[start],
"-c")) {
290 if (argc > (start + 1)) {
291 max_channel = atoi(argv[start + 1]);
301 max_channel = (max_channel > 16) ? 16 : max_channel;
313 PX4_ERR(
"Sbus driver initialization failed");
320 PX4_ERR(
"Linux sbus module failure");
328 PX4_WARN(
"Not running \n");
354 PX4_INFO(
"Not running \n");
361 "Usage: linux_sbus start|stop|status -d <device> -c <channel>");
static void usage(const char *reason)
Print the correct usage.
#define SBUS_SCALE_FACTOR
#define RCINPUT_MEASURE_INTERVAL_US
static RcInput * rc_input
int linux_sbus_main(int argc, char **argv)
orb_advert_t orb_advertise(const struct orb_metadata *meta, const void *data)
#define SBUS_SCALE_OFFSET
Namespace encapsulating all device framework classes, functions and data.
static void read(bootloader_app_shared_t *pshared)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).