PX4 Firmware
PX4 Autopilot Software http://px4.io
hott_sensors.cpp File Reference
#include <fcntl.h>
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/defines.h>
#include <px4_platform_common/tasks.h>
#include <poll.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <systemlib/err.h>
#include "../comms.h"
#include "../messages.h"
Include dependency graph for hott_sensors.cpp:

Go to the source code of this file.

Macros

#define DEFAULT_UART   "/dev/ttyS0";
 USART1. More...
 

Functions

__EXPORT int hott_sensors_main (int argc, char *argv[])
 Deamon management function. More...
 
int hott_sensors_thread_main (int argc, char *argv[])
 Mainloop of daemon. More...
 
static int recv_data (int uart, uint8_t *buffer, size_t *size, uint8_t *id)
 
static int send_poll (int uart, uint8_t *buffer, size_t size)
 

Variables

static int thread_should_exit = false
 Deamon exit flag. More...
 
static int thread_running = false
 Deamon status flag. More...
 
static int deamon_task
 Handle of deamon task / thread. More...
 
static const char daemon_name [] = "hott_sensors"
 
static const char commandline_usage [] = "usage: hott_sensors start|status|stop [-d <device>]"
 

Macro Definition Documentation

◆ DEFAULT_UART

#define DEFAULT_UART   "/dev/ttyS0";

USART1.

Definition at line 59 of file hott_sensors.cpp.

Referenced by hott_sensors_thread_main().

Function Documentation

◆ hott_sensors_main()

int hott_sensors_main ( int  argc,
char *  argv[] 
)

Deamon management function.

Process command line arguments and start the daemon.

Definition at line 200 of file hott_sensors.cpp.

References commandline_usage, daemon_name, deamon_task, errx, hott_sensors_thread_main(), thread_running, thread_should_exit, and warnx.

Here is the call graph for this function:

◆ hott_sensors_thread_main()

int hott_sensors_thread_main ( int  argc,
char *  argv[] 
)

Mainloop of daemon.

Definition at line 135 of file hott_sensors.cpp.

References build_gam_request(), commandline_usage, DEFAULT_UART, errx, GAM_SENSOR_ID, init_pub_messages(), MAX_MESSAGE_BUFFER_SIZE, open_uart(), publish_gam_message(), recv_data(), send_poll(), thread_running, thread_should_exit, and warnx.

Referenced by hott_sensors_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recv_data()

int recv_data ( int  uart,
uint8_t *  buffer,
size_t *  size,
uint8_t *  id 
)
static

Definition at line 99 of file hott_sensors.cpp.

References OK, read(), STOP_BYTE, and timeout_ms.

Referenced by i2cdetect::detect(), and hott_sensors_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_poll()

int send_poll ( int  uart,
uint8_t *  buffer,
size_t  size 
)
static

Definition at line 81 of file hott_sensors.cpp.

References OK, POST_WRITE_DELAY_IN_USECS, read(), and write().

Referenced by hott_sensors_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ commandline_usage

const char commandline_usage[] = "usage: hott_sensors start|status|stop [-d <device>]"
static

Definition at line 65 of file hott_sensors.cpp.

Referenced by hott_sensors_main(), and hott_sensors_thread_main().

◆ daemon_name

const char daemon_name[] = "hott_sensors"
static

Definition at line 64 of file hott_sensors.cpp.

Referenced by hott_sensors_main().

◆ deamon_task

int deamon_task
static

Handle of deamon task / thread.

Definition at line 63 of file hott_sensors.cpp.

Referenced by hott_sensors_main().

◆ thread_running

int thread_running = false
static

Deamon status flag.

Definition at line 62 of file hott_sensors.cpp.

Referenced by hott_sensors_main(), and hott_sensors_thread_main().

◆ thread_should_exit

int thread_should_exit = false
static

Deamon exit flag.

Definition at line 61 of file hott_sensors.cpp.

Referenced by hott_sensors_main(), and hott_sensors_thread_main().