|
| 1 | +/** |
| 2 | + * @file gpsdriver.h |
| 3 | + * @brief GPS Driver interface used by GPS library |
| 4 | + * |
| 5 | + */ |
| 6 | +#ifndef INC_GPSDRIVER_H_ |
| 7 | +#define INC_GPSDRIVER_H_ |
| 8 | + |
| 9 | +#ifdef __cplusplus |
| 10 | +extern "C" |
| 11 | +{ |
| 12 | +#endif |
| 13 | + |
| 14 | +/** |
| 15 | + * @brief GNSS message to enable |
| 16 | + * |
| 17 | + */ |
| 18 | +enum gnssmsg_e { |
| 19 | + NMEA_GGA = 1 << 0, |
| 20 | + NMEA_GLL = 1 << 1, |
| 21 | + NMEA_GSA = 1 << 2, |
| 22 | + NMEA_GSV = 1 << 3, |
| 23 | + NMEA_RMC = 1 << 4, |
| 24 | + NMEA_VTG = 1 << 5, |
| 25 | +}; |
| 26 | + |
| 27 | +/** |
| 28 | + * @brief Module operation mode (if supported) |
| 29 | + * |
| 30 | + */ |
| 31 | +enum gnssopmode_e { |
| 32 | + OPMODE_NORMAL, |
| 33 | + OPMODE_SLOW, |
| 34 | +}; |
| 35 | + |
| 36 | +/** |
| 37 | + * @brief GNSS software reset type |
| 38 | + * |
| 39 | + */ |
| 40 | +enum gnssreset_e { |
| 41 | + RESET_HOT, |
| 42 | + RESET_WARM, |
| 43 | + RESET_COLD, |
| 44 | +}; |
| 45 | + |
| 46 | +/** |
| 47 | + * @brief GPS Driver Structure |
| 48 | + * |
| 49 | + */ |
| 50 | +struct gpsdriver_t { |
| 51 | + /** Driver Name */ |
| 52 | + const char *name; |
| 53 | + /** Command require checksum? 1 - yes, 0 - no */ |
| 54 | + int command_checksum; |
| 55 | + /** List of module specific response identifier */ |
| 56 | + const char ** const response_ident; |
| 57 | + /** count of @ref response_ident */ |
| 58 | + int response_ident_count; |
| 59 | + /** |
| 60 | + * @brief Perform software reset, NULL if not implemented |
| 61 | + * |
| 62 | + * @param type reset type @ref gnssreset_e |
| 63 | + * @return status, 0 for success |
| 64 | + */ |
| 65 | + int (*restart)(int type); |
| 66 | + /** |
| 67 | + * @brief Configure GNSS module, NULL if not implemented |
| 68 | + * |
| 69 | + * @param msg_type bitwise ORed value of @ref gnssmsg_e, for messages to be enabled |
| 70 | + * @param rate_ms output datarate in ms, currently unused (1000ms default) |
| 71 | + * @param op_mode Operation mode to configure GNSS module for Normal or slow motion operation |
| 72 | + * @return status, 0 for success |
| 73 | + */ |
| 74 | + int (*config)(unsigned int msg_type, unsigned int rate_ms, int op_mode); |
| 75 | + /** |
| 76 | + * @brief Setup/change baudrate, called from gpsbaud command handler, NULL if not implemented |
| 77 | + * |
| 78 | + * @param baud baudrate to set |
| 79 | + * @return status, 0 for success |
| 80 | + */ |
| 81 | + int (*setup_baud)(unsigned int baud); |
| 82 | + /** |
| 83 | + * @brief callback function for module specific reponse identifiers @var response_ident |
| 84 | + * NULL if not implemented |
| 85 | + * |
| 86 | + * @param msg response (without checksum) |
| 87 | + * @return status, 0 for success |
| 88 | + */ |
| 89 | + int (*response_handler)(const char *msg); |
| 90 | + unsigned int reserved; /** must be 0 */ |
| 91 | +}; |
| 92 | + |
| 93 | +/** |
| 94 | + * @brief Set GPS driver for chipset with CASIC GNSS recevier protocol e.g. AT6558 |
| 95 | + * |
| 96 | + * This driver is used in following GNSS modules or as integrated GNSS |
| 97 | + * |
| 98 | + * 1. Neoway N58 LTE Cat.1 |
| 99 | + * 2. Neoway G2 |
| 100 | + * 3. Neoway G7A |
| 101 | + * 4. AT6558 |
| 102 | + * |
| 103 | + * @return 0 on success |
| 104 | + */ |
| 105 | +int gps_set_driver_casic(void); |
| 106 | + |
| 107 | +/** |
| 108 | + * @brief Set GPS driver to Quectel L89R2.0 GNSS/IRNSS Module |
| 109 | + * |
| 110 | + * @return 0 on success |
| 111 | + */ |
| 112 | +int gps_set_driver_l89r2(void); |
| 113 | + |
| 114 | +/** |
| 115 | + * @brief Set GPS driver to module using MT3333 or MT3339 chipset |
| 116 | + * |
| 117 | + * This driver can be used for following GNSS/GSM Modules |
| 118 | + * |
| 119 | + * 1. Quectel L86 |
| 120 | + * 2. Quectel MC60 |
| 121 | + * 3. Quectel MC20 |
| 122 | + * |
| 123 | + * @return 0 on success |
| 124 | + */ |
| 125 | +int gps_set_driver_mt333x(void); |
| 126 | + |
| 127 | +/** |
| 128 | + * @brief GPS driver for SIRF III chipset |
| 129 | + * |
| 130 | + * @return 0 on success |
| 131 | + */ |
| 132 | +int gps_set_driver_sirf3(void); |
| 133 | + |
| 134 | +/** |
| 135 | + * @brief GPS driver for STA8090 chipset |
| 136 | + * |
| 137 | + * This driver can be used for Quectel L89 IRNSS module. |
| 138 | + * |
| 139 | + * @note Please do not confuse with L89 and L89R2, check datasheet |
| 140 | + * before using correct driver. |
| 141 | + * |
| 142 | + * @return int |
| 143 | + */ |
| 144 | +int gps_set_driver_stirnss(void); |
| 145 | + |
| 146 | +/** |
| 147 | + * @brief GPS Driver for uc6226 uc6228 chipset |
| 148 | + * |
| 149 | + * This driver can be used for following modules: |
| 150 | + * |
| 151 | + * 1. Quectel L76C |
| 152 | + * 2. Quectel L26C |
| 153 | + * 3. Quectel BC20 (NB-IoT) |
| 154 | + * 4. Quectel EC200UCN-AA LTE Cat.1 Module |
| 155 | + * |
| 156 | + * @return 0 on success |
| 157 | + */ |
| 158 | +int gps_set_driver_uc622x(void); |
| 159 | + |
| 160 | +/** |
| 161 | + * @brief Set custom defined GPS driver |
| 162 | + * |
| 163 | + * @param driver GPS module driver structure |
| 164 | + * @return 0 on success, negative on failure |
| 165 | + */ |
| 166 | +int gps_set_driver(const struct gpsdriver_t *driver); |
| 167 | + |
| 168 | +#ifdef __cplusplus |
| 169 | +} |
| 170 | +#endif |
| 171 | + |
| 172 | +#endif /* INC_GPSDRIVER_H_ */ |
0 commit comments