Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
4ab8c2a6
Commit
4ab8c2a6
authored
6 years ago
by
Alessandro Simovic
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tap_esc: made _uart_fd a class member
parent
64aab8a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/tap_esc/tap_esc.cpp
+6
-4
6 additions, 4 deletions
src/drivers/tap_esc/tap_esc.cpp
with
6 additions
and
4 deletions
src/drivers/tap_esc/tap_esc.cpp
+
6
−
4
View file @
4ab8c2a6
...
...
@@ -79,7 +79,6 @@
* This driver connects to TAP ESCs via serial.
*/
static
int
_uart_fd
=
-
1
;
//todo:refactor in to class
class
TAP_ESC
:
public
device
::
CDev
,
public
ModuleParams
{
public:
...
...
@@ -96,13 +95,14 @@ public:
MODE_5CAP
,
MODE_6CAP
,
};
TAP_ESC
(
int
channels_count
);
TAP_ESC
(
int
channels_count
,
int
uart_fd
);
virtual
~
TAP_ESC
();
virtual
int
init
();
virtual
int
ioctl
(
device
::
file_t
*
filp
,
int
cmd
,
unsigned
long
arg
);
void
cycle
();
private
:
int
_uart_fd
;
static
const
uint8_t
device_mux_map
[
TAP_ESC_MAX_MOTOR_NUM
];
static
const
uint8_t
device_dir_map
[
TAP_ESC_MAX_MOTOR_NUM
];
...
...
@@ -173,9 +173,10 @@ TAP_ESC *tap_esc = nullptr;
# define TAP_ESC_DEVICE_PATH "/dev/tap_esc"
TAP_ESC
::
TAP_ESC
(
int
channels_count
)
:
TAP_ESC
::
TAP_ESC
(
int
channels_count
,
int
uart_fd
)
:
CDev
(
"tap_esc"
,
TAP_ESC_DEVICE_PATH
),
ModuleParams
(
nullptr
),
_uart_fd
(
uart_fd
),
_is_armed
(
false
),
_poll_fds_num
(
0
),
_mode
(
MODE_4PWM
),
//FIXME: what is this mode used for???
...
...
@@ -937,6 +938,7 @@ namespace tap_esc_drv
volatile
bool
_task_should_exit
=
false
;
// flag indicating if tap_esc task should exit
static
int
_uart_fd
=
-
1
;
static
char
_device
[
32
]
=
{};
static
bool
_is_running
=
false
;
// flag indicating if tap_esc app is running
static
px4_task_t
_task_handle
=
-
1
;
// handle to the task main thread
...
...
@@ -967,7 +969,7 @@ int tap_esc_start(void)
if
(
tap_esc
==
nullptr
)
{
tap_esc
=
new
TAP_ESC
(
_supported_channel_count
);
tap_esc
=
new
TAP_ESC
(
_supported_channel_count
,
_uart_fd
);
if
(
tap_esc
==
nullptr
)
{
ret
=
-
ENOMEM
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment