-
Notifications
You must be signed in to change notification settings - Fork 18
/
regdef.gps.neo6.i2c.sb
116 lines (102 loc) · 7.13 KB
/
regdef.gps.neo6.i2c.sb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//******************************************************************************
// Copyright (c) 2016, Laird
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// SPDX-License-Identifier:ISC
////////////////////////////////////////////////////////////////////////////////
// I2C GPS NAV registers
////////////////////////////////////////////////////////////////////////////////
//
#define I2C_GPS_STATUS_00 00 //(Read only)
#define I2C_GPS_STATUS_NEW_DATA 0x01 // New data is available (after every GGA frame)
#define I2C_GPS_STATUS_2DFIX 0x02 // 2dfix achieved
#define I2C_GPS_STATUS_3DFIX 0x04 // 3dfix achieved
#define I2C_GPS_STATUS_WP_REACHED 0x08 // Active waypoint has been reached (not cleared until new waypoint is set)
#define I2C_GPS_STATUS_NUMSATS 0xF0 // Number of sats in view
#define I2C_GPS_COMMAND 01 //(Write only)
#define I2C_GPS_COMMAND_POSHOLD 0x01 // Start position hold at the current gps positon
#define I2C_GPS_COMMAND_START_NAV 0x02 // Get the WP from the command and start navigating toward it
#define I2C_GPS_COMMAND_SET_WP 0x03 // Copy current position to given WP
#define I2C_GPS_COMMAND_UPDATE_PIDS 0x04 // Update PI and PID controllers from the PID registers, this must be called after a pid register is changed
#define I2C_GPS_COMMAND_NAV_OVERRIDE 0x05 // Do not nav since we tring to controll the copter manually (not implemented yet)
#define I2C_GPS_COMMAND_STOP_NAV 0x06 // Stop navigation (zeroes out nav_lat and nav_lon
#define I2C_GPS_COMMAND__7 0x07
#define I2C_GPS_COMMAND__8 0x08
#define I2C_GPS_COMMAND__9 0x09
#define I2C_GPS_COMMAND__a 0x0a
#define I2C_GPS_COMMAND__b 0x0b
#define I2C_GPS_COMMAND__c 0x0c
#define I2C_GPS_COMMAND__d 0x0d
#define I2C_GPS_COMMAND__e 0x0e
#define I2C_GPS_COMMAND__f 0x0f
#define I2C_GPS_COMMAND_WP_MASK 0xF0 //Waypoint number
#define I2C_GPS_WP_REG 02 //Waypoint register (Read only)
#define I2C_GPS_WP_REG_ACTIVE_MASK 0x0F //Active Waypoint lower 4 bits
#define I2C_GPS_WP_REG_PERVIOUS_MASK 0xF0 //Pervious Waypoint upper 4 bits
#define I2C_GPS_REG_VERSION 03 //Version of the I2C_NAV SW uint8_t
#define I2C_GPS_REG_RES2 04 //Reserved for future use (uint8_t)
#define I2C_GPS_REG_RES3 05 //Reserved for future use (uint8_t)
#define I2C_GPS_REG_RES4 06 //Reserved for future use (uint8_t)
#define I2C_GPS_LOCATION 07 //Current location 8 byte (lat, lon) int32_t
#define I2C_GPS_NAV_LAT 15 //Desired banking towards north/south int16_t
#define I2C_GPS_NAV_LON 17 //Desired banking toward east/west int16_t
#define I2C_GPS_WP_DISTANCE 19 //Distance to current WP in cm uint32
#define I2C_GPS_WP_TARGET_BEARING 23 //Bearing towards current wp 1deg = 1000 int16_t
#define I2C_GPS_NAV_BEARING 25 //Crosstrack corrected bearing towards current wp 1deg = 1000 int16_t
#define I2C_GPS_HOME_TO_COPTER_BEARING 27 //Bearing from home to copter 1deg = 1000 int16_t
#define I2C_GPS_DISTANCE_TO_HOME 29 //Distance to home in m int16_t
#define I2C_GPS_GROUND_SPEED 31 //GPS ground speed in m/s*100 (uint16_t) (Read Only)
#define I2C_GPS_ALTITUDE 33 //GPS altitude in meters (uint16_t) (Read Only)
#define I2C_GPS_GROUND_COURSE 35 //GPS ground course (uint16_t)
#define I2C_GPS_RES1 37 //Reserved for future use (uint16_t)
#define I2C_GPS_TIME 39 //UTC Time from GPS in hhmmss.sss * 100 (uint32_t)(unneccesary precision) (Read Only)
//Writeable registers from here
#define I2C_GPS_CROSSTRACK_GAIN 43 //Crosstrack gain *100 (1 - 0.01 100 - 1) uint8_t
#define I2C_GPS_SPEED_MIN 44 //Minimum navigation speed cm/s uint8_t
#define I2C_GPS_SPEED_MAX 45 //Maximum navigation speed cm/s uint16_t
#define I2C_GPS_RESERVED 47 //Reserved for future use
#define I2C_GPS_WP_RADIUS 49 //Radius of the wp in cm, within this radius we consider the wp reached (uint16_t)
#define I2C_GPS_NAV_FLAGS 51 //Controls various functions of the I2C-GPS-NAV module
#define I2C_NAV_FLAG_GPS_FILTER 0x80 //If this bit set GPS coordinates are filtered via a 5 element moving average filter
#define I2C_NAV_FLAG_LOW_SPEED_D_FILTER 0x40 //If speed below .5m/s ignore D term in POSHOLD_RATE, this supposed to filter out noise
#define I2C_GPS_HOLD_P 52 //Poshold_P *100 uint16_t
#define I2C_GPS_HOLD_I 53 //Poshold_I *100 uint16_t
#define I2C_GPS_HOLD_IMAX 54 //Poshold_IMAX *1 uint8_t
#define I2C_GPS_HOLD_RATE_P 55 //Poshold_rate_P *10 uint16_t
#define I2C_GPS_HOLD_RATE_I 56 //Poshold_rate_I *100 uint16_t
#define I2C_GPS_HOLD_RATE_D 57 //Poshold_rate_D *1000 uint16_t
#define I2C_GPS_HOLD_RATE_IMAX 58 //Poshold_rate_IMAX *1 uint8_t
#define I2C_GPS_NAV_P 59 //Nav_P *10 uint16_t
#define I2C_GPS_NAV_I 60 //Nav_I *100 uint16_t
#define I2C_GPS_NAV_D 61 //Nav_D *1000 uint16_t
#define I2C_GPS_NAV_IMAX 62 //Nav_IMAX *1 uint8_t
#define I2C_GPS_WP0 63 //Waypoint 0 used for RTH location (R/W)
#define I2C_GPS_WP1 74
#define I2C_GPS_WP2 85
#define I2C_GPS_WP3 96
#define I2C_GPS_WP4 107
#define I2C_GPS_WP5 118
#define I2C_GPS_WP6 129
#define I2C_GPS_WP7 140
#define I2C_GPS_WP8 151
#define I2C_GPS_WP9 162
#define I2C_GPS_WP10 173
#define I2C_GPS_WP11 184
#define I2C_GPS_WP12 195
#define I2C_GPS_WP13 206
#define I2C_GPS_WP14 217
#define I2C_GPS_WP15 228
///////////////////////////////////////////////////////////////////////////////////////////////////
// End register definition
///////////////////////////////////////////////////////////////////////////////////////////////////