diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-11-21 08:17:50 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2014-11-26 08:41:32 +1100 |
commit | 7ae4f6d97e398a64aeb99c52880651a2282be5b9 (patch) | |
tree | 4214888c14f92bc6c2013f25b701800a5b003469 /src/modules/uavcan/uavcan_main.hpp | |
parent | a7a68c88a25c2c4cb401fb4f8894de6f4c280ba2 (diff) | |
download | px4-firmware-7ae4f6d97e398a64aeb99c52880651a2282be5b9.tar.gz px4-firmware-7ae4f6d97e398a64aeb99c52880651a2282be5b9.tar.bz2 px4-firmware-7ae4f6d97e398a64aeb99c52880651a2282be5b9.zip |
uavcan: added add_poll_fd() helper function
this makes the code clearer and avoids repeated code
Diffstat (limited to 'src/modules/uavcan/uavcan_main.hpp')
-rw-r--r-- | src/modules/uavcan/uavcan_main.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index 5a036fcd7..98f2e5ad4 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -58,6 +58,9 @@ #define NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN 4 #define UAVCAN_DEVICE_PATH "/dev/uavcan/esc" +// we add two to allow for actuator_direct and busevent +#define UAVCAN_NUM_POLL_FDS (NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN+2) + /** * A UAVCAN node. */ @@ -98,6 +101,8 @@ private: int init(uavcan::NodeID node_id); void node_spin_once(); int run(); + int add_poll_fd(int fd); ///< add a fd to poll list, returning index into _poll_fds[] + int _task = -1; ///< handle to the OS task bool _task_should_exit = false; ///< flag to indicate to tear down the CAN driver @@ -126,7 +131,7 @@ private: int _control_subs[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN] = {}; actuator_controls_s _controls[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN] = {}; orb_id_t _control_topics[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN] = {}; - pollfd _poll_fds[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN + 1] = {}; ///< +1 for /dev/uavcan/busevent + pollfd _poll_fds[UAVCAN_NUM_POLL_FDS] = {}; unsigned _poll_fds_num = 0; int _actuator_direct_sub = -1; ///< uORB subscription of the actuator_direct topic |