GPS_detect_state.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. */
  13. /*
  14. GPS detection state structures. These need to be in a separate
  15. header to prevent a circular dependency between AP_GPS and the
  16. backend drivers.
  17. These structures are allocated as a single block in AP_GPS during
  18. driver detection, then freed once the detection is finished. Each
  19. GPS driver needs to implement a static _detect() function which uses
  20. this state information to detect if the attached GPS is of the
  21. specific type that it handles.
  22. */
  23. struct MTK19_detect_state {
  24. uint8_t payload_counter;
  25. uint8_t step;
  26. uint8_t ck_a, ck_b;
  27. };
  28. struct MTK_detect_state {
  29. uint8_t payload_counter;
  30. uint8_t step;
  31. uint8_t ck_a, ck_b;
  32. };
  33. struct NMEA_detect_state {
  34. uint8_t step;
  35. uint8_t ck;
  36. };
  37. struct SIRF_detect_state {
  38. uint16_t checksum;
  39. uint8_t step, payload_length, payload_counter;
  40. };
  41. struct UBLOX_detect_state {
  42. uint8_t payload_length, payload_counter;
  43. uint8_t step;
  44. uint8_t ck_a, ck_b;
  45. };
  46. struct ERB_detect_state {
  47. uint8_t payload_length, payload_counter;
  48. uint8_t step;
  49. uint8_t ck_a, ck_b;
  50. };
  51. struct SBP_detect_state {
  52. enum {
  53. WAITING = 0,
  54. GET_TYPE = 1,
  55. GET_SENDER = 2,
  56. GET_LEN = 3,
  57. GET_MSG = 4,
  58. GET_CRC = 5
  59. } state:8;
  60. uint16_t msg_type;
  61. uint8_t n_read;
  62. uint8_t msg_len;
  63. uint16_t crc_so_far;
  64. uint16_t crc;
  65. uint8_t heartbeat_buff[4];
  66. };
  67. struct SBP2_detect_state {
  68. enum {
  69. WAITING = 0,
  70. GET_TYPE = 1,
  71. GET_SENDER = 2,
  72. GET_LEN = 3,
  73. GET_MSG = 4,
  74. GET_CRC = 5
  75. } state:8;
  76. uint16_t msg_type;
  77. uint8_t n_read;
  78. uint8_t msg_len;
  79. uint16_t crc_so_far;
  80. uint16_t crc;
  81. uint8_t heartbeat_buff[4];
  82. };