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
80771ce8
Commit
80771ce8
authored
8 years ago
by
Beat Küng
Committed by
Lorenz Meier
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gps: remove gps_driver_interface_t and use GPSHelper::Interface instead
parent
c6f43689
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/drivers/drv_gps.h
+0
-5
0 additions, 5 deletions
src/drivers/drv_gps.h
src/drivers/gps/gps.cpp
+12
-27
12 additions, 27 deletions
src/drivers/gps/gps.cpp
with
12 additions
and
32 deletions
src/drivers/drv_gps.h
+
0
−
5
View file @
80771ce8
...
...
@@ -57,8 +57,3 @@ typedef enum {
GPS_DRIVER_MODE_MTK
,
GPS_DRIVER_MODE_ASHTECH
}
gps_driver_mode_t
;
typedef
enum
{
GPS_DRIVER_UART
=
0
,
GPS_DRIVER_SPI
}
gps_driver_interface_t
;
This diff is collapsed.
Click to expand it.
src/drivers/gps/gps.cpp
+
12
−
27
View file @
80771ce8
...
...
@@ -103,7 +103,7 @@ public:
class
GPS
{
public:
GPS
(
const
char
*
path
,
gps_driver_mode_t
mode
,
gps_driver_i
nterface
_t
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
GPS
(
const
char
*
path
,
gps_driver_mode_t
mode
,
GPSHelper
::
I
nterface
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
int
gps_num
);
virtual
~
GPS
();
...
...
@@ -124,9 +124,9 @@ private:
bool
_healthy
;
///< flag to signal if the GPS is ok
bool
_baudrate_changed
;
///< flag to signal that the baudrate with the GPS has changed
bool
_mode_changed
;
///< flag that the GPS mode has changed
bool
_mode_auto
;
bool
_mode_auto
;
///< if true, auto-detect which GPS is attached
gps_driver_mode_t
_mode
;
///< current mode
gps_driver_i
nterface
_t
_interface
;
///< interface
GPSHelper
::
I
nterface
_interface
;
///< interface
GPSHelper
*
_helper
;
///< instance of GPS parser
GPS_Sat_Info
*
_sat_info
;
///< instance of GPS sat info data object
struct
vehicle_gps_position_s
_report_gps_pos
;
///< uORB topic for gps position
...
...
@@ -244,7 +244,7 @@ volatile bool is_gps1_advertised = false; ///< for the second gps we want to mak
}
GPS
::
GPS
(
const
char
*
path
,
gps_driver_mode_t
mode
,
gps_driver_i
nterface
_t
interface
,
bool
fake_gps
,
GPS
::
GPS
(
const
char
*
path
,
gps_driver_mode_t
mode
,
GPSHelper
::
I
nterface
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
int
gps_num
)
:
_task_should_exit
(
false
),
_healthy
(
false
),
...
...
@@ -708,27 +708,12 @@ GPS::task_main()
_helper
=
nullptr
;
}
GPSHelper
::
Interface
helper_interface
=
GPSHelper
::
Interface
::
UART
;
switch
(
_interface
)
{
case
GPS_DRIVER_UART
:
helper_interface
=
GPSHelper
::
Interface
::
UART
;
break
;
case
GPS_DRIVER_SPI
:
helper_interface
=
GPSHelper
::
Interface
::
SPI
;
break
;
default:
break
;
}
switch
(
_mode
)
{
case
GPS_DRIVER_MODE_NONE
:
_mode
=
GPS_DRIVER_MODE_UBX
;
//no break
case
GPS_DRIVER_MODE_UBX
:
_helper
=
new
GPSDriverUBX
(
helper
_interface
,
&
GPS
::
callback
,
this
,
&
_report_gps_pos
,
_p_report_sat_info
);
_helper
=
new
GPSDriverUBX
(
_interface
,
&
GPS
::
callback
,
this
,
&
_report_gps_pos
,
_p_report_sat_info
);
break
;
case
GPS_DRIVER_MODE_MTK
:
...
...
@@ -975,7 +960,7 @@ namespace gps
{
void
start
(
const
char
*
path
,
gps_driver_mode_t
mode
,
gps_driver_i
nterface
_t
interface
,
bool
fake_gps
,
void
start
(
const
char
*
path
,
gps_driver_mode_t
mode
,
GPSHelper
::
I
nterface
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
int
gps_num
);
void
stop
();
void
test
();
...
...
@@ -986,7 +971,7 @@ void info();
* Start the driver.
*/
void
start
(
const
char
*
path
,
gps_driver_mode_t
mode
,
gps_driver_i
nterface
_t
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
start
(
const
char
*
path
,
gps_driver_mode_t
mode
,
GPSHelper
::
I
nterface
interface
,
bool
fake_gps
,
bool
enable_sat_info
,
int
gps_num
)
{
if
(
g_dev
[
gps_num
-
1
]
!=
nullptr
)
{
...
...
@@ -1076,7 +1061,7 @@ gps_main(int argc, char *argv[])
const
char
*
device_name2
=
nullptr
;
bool
fake_gps
=
false
;
bool
enable_sat_info
=
false
;
gps_driver_i
nterface
_t
interface
=
GPS
_DRIVER_
UART
;
GPSHelper
::
I
nterface
interface
=
GPS
Helper
::
Interface
::
UART
;
gps_driver_mode_t
mode
=
GPS_DRIVER_MODE_NONE
;
if
(
argc
<
2
)
{
...
...
@@ -1120,10 +1105,10 @@ gps_main(int argc, char *argv[])
if
(
interface_arg
<
argc
)
{
if
(
!
strcmp
(
argv
[
interface_arg
],
"spi"
))
{
interface
=
GPS
_DRIVER_
SPI
;
interface
=
GPS
Helper
::
Interface
::
SPI
;
}
else
if
(
!
strcmp
(
argv
[
interface_arg
],
"uart"
))
{
interface
=
GPS
_DRIVER_
UART
;
interface
=
GPS
Helper
::
Interface
::
UART
;
}
}
}
...
...
@@ -1198,6 +1183,6 @@ gps_main(int argc, char *argv[])
out
:
PX4_ERR
(
"unrecognized command, try 'start', 'stop', 'test', 'reset' or 'status'"
);
PX4_ERR
(
"[-d "
GPS_DEFAULT_UART_PORT
"][-f (for enabling fake)][-s (to enable sat info)]"
);
PX4_ERR
(
"[-d "
GPS_DEFAULT_UART_PORT
"][-f (for enabling fake)][-s (to enable sat info)]
[-i {spi|uart}] [-p {ubx|mtk|ash}]
"
);
return
1
;
}
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