39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52#include "drv_spi_master.h"
76#define GNSSRTK2_RSP_START "$"
77#define GNSSRTK2_RSP_DELIMITER ","
78#define GNSSRTK2_RSP_GNGGA "$GNGGA"
84#define GNSSRTK2_GNGGA_ELEMENT_SIZE 15
85#define GNSSRTK2_GNGGA_TIME 1
86#define GNSSRTK2_GNGGA_LATITUDE 2
87#define GNSSRTK2_GNGGA_LATITUDE_SIDE 3
88#define GNSSRTK2_GNGGA_LONGITUDE 4
89#define GNSSRTK2_GNGGA_LONGITUDE_SIDE 5
90#define GNSSRTK2_GNGGA_QUALITY_INDICATOR 6
91#define GNSSRTK2_GNGGA_NUMBER_OF_SATELLITES 7
92#define GNSSRTK2_GNGGA_H_DILUTION_OF_POS 8
93#define GNSSRTK2_GNGGA_ALTITUDE 9
94#define GNSSRTK2_GNGGA_ALTITUDE_UNIT 10
95#define GNSSRTK2_GNGGA_GEOIDAL_SEPARATION 11
96#define GNSSRTK2_GNGGA_GEOIDAL_SEPARATION_UNIT 12
97#define GNSSRTK2_GNGGA_TIME_SINCE_LAST_DGPS 13
98#define GNSSRTK2_GNGGA_DGPS_REFERENCE_STATION_ID 14
104#define GNSSRTK2_DUMMY 0xFF
111#define GNSSRTK2_SET_DEV_ADDR 0x42
118#define DRV_TX_BUFFER_SIZE 100
119#define DRV_RX_BUFFER_SIZE 300
129#define GNSSRTK2_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
130#define GNSSRTK2_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
148#define GNSSRTK2_MAP_MIKROBUS( cfg, mikrobus ) \
149 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
150 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
151 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
152 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
153 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
154 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
155 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
156 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
157 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_AN ); \
158 cfg.rtk = MIKROBUS( mikrobus, MIKROBUS_RST ); \
159 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
160 cfg.tmp = MIKROBUS( mikrobus, MIKROBUS_INT )
gnssrtk2_drv_t
GNSS RTK 2 Click driver selector.
Definition gnssrtk2.h:170
@ GNSSRTK2_DRV_SEL_UART
Definition gnssrtk2.h:171
@ GNSSRTK2_DRV_SEL_SPI
Definition gnssrtk2.h:172
@ GNSSRTK2_DRV_SEL_I2C
Definition gnssrtk2.h:173
struct gnssrtk2_s gnssrtk2_t
GNSS RTK 2 Click context object.
err_t(* gnssrtk2_master_io_t)(struct gnssrtk2_s *, uint8_t *, uint8_t)
GNSS RTK 2 Click driver interface.
Definition gnssrtk2.h:181
gnssrtk2_return_value_t
GNSS RTK 2 Click return value data.
Definition gnssrtk2.h:254
@ GNSSRTK2_OK
Definition gnssrtk2.h:255
@ GNSSRTK2_ERROR
Definition gnssrtk2.h:256
#define DRV_RX_BUFFER_SIZE
Definition gnssrtk2.h:119
#define DRV_TX_BUFFER_SIZE
GNSS RTK 2 driver buffer size.
Definition gnssrtk2.h:118
uint8_t gnssrtk2_get_rdy_pin(gnssrtk2_t *ctx)
GNSS RTK 2 get RDY pin function.
err_t gnssrtk2_generic_read(gnssrtk2_t *ctx, uint8_t *data_out, uint8_t len)
GNSS RTK 2 data reading function.
uint8_t gnssrtk2_get_rtk_pin(gnssrtk2_t *ctx)
GNSS RTK 2 get RTK pin function.
err_t gnssrtk2_init(gnssrtk2_t *ctx, gnssrtk2_cfg_t *cfg)
GNSS RTK 2 initialization function.
void gnssrtk2_reset_device(gnssrtk2_t *ctx)
GNSS RTK 2 reset device function.
void gnssrtk2_cfg_setup(gnssrtk2_cfg_t *cfg)
GNSS RTK 2 configuration object setup function.
err_t gnssrtk2_generic_write(gnssrtk2_t *ctx, uint8_t *data_in, uint8_t len)
GNSS RTK 2 data writing function.
uint8_t gnssrtk2_get_tmp_pin(gnssrtk2_t *ctx)
GNSS RTK 2 get TMP pin function.
void gnssrtk2_set_rst_pin(gnssrtk2_t *ctx, uint8_t state)
GNSS RTK 2 set RST pin function.
err_t gnssrtk2_parse_gngga(char *rsp_buf, uint8_t gngga_element, char *element_data)
GNSS RTK 2 parse GNGGA function.
void gnssrtk2_drv_interface_selection(gnssrtk2_cfg_t *cfg, gnssrtk2_drv_t drv_sel)
GNSS RTK 2 driver interface setup function.
This file contains SPI specific macros, functions, etc.
GNSS RTK 2 Click configuration object.
Definition gnssrtk2.h:217
uint32_t baud_rate
Definition gnssrtk2.h:239
pin_name_t tmp
Definition gnssrtk2.h:230
uint32_t i2c_speed
Definition gnssrtk2.h:232
spi_master_chip_select_polarity_t cs_polarity
Definition gnssrtk2.h:237
bool uart_blocking
Definition gnssrtk2.h:240
pin_name_t sck
Definition gnssrtk2.h:222
uart_data_bits_t data_bit
Definition gnssrtk2.h:241
spi_master_mode_t spi_mode
Definition gnssrtk2.h:236
pin_name_t tx_pin
Definition gnssrtk2.h:225
gnssrtk2_drv_t drv_sel
Definition gnssrtk2.h:245
pin_name_t mosi
Definition gnssrtk2.h:221
uint32_t spi_speed
Definition gnssrtk2.h:235
pin_name_t rtk
Definition gnssrtk2.h:228
pin_name_t rx_pin
Definition gnssrtk2.h:224
uart_stop_bits_t stop_bit
Definition gnssrtk2.h:243
pin_name_t scl
Definition gnssrtk2.h:218
pin_name_t rdy
Definition gnssrtk2.h:227
pin_name_t miso
Definition gnssrtk2.h:220
uart_parity_t parity_bit
Definition gnssrtk2.h:242
pin_name_t sda
Definition gnssrtk2.h:219
pin_name_t rst
Definition gnssrtk2.h:229
pin_name_t cs
Definition gnssrtk2.h:223
uint8_t i2c_address
Definition gnssrtk2.h:233
GNSS RTK 2 Click context object.
Definition gnssrtk2.h:188
spi_master_t spi
Definition gnssrtk2.h:196
gnssrtk2_master_io_t read_f
Definition gnssrtk2.h:208
gnssrtk2_master_io_t write_f
Definition gnssrtk2.h:207
uart_t uart
Definition gnssrtk2.h:197
i2c_master_t i2c
Definition gnssrtk2.h:195
char uart_rx_buffer[DRV_RX_BUFFER_SIZE]
Definition gnssrtk2.h:200
gnssrtk2_drv_t drv_sel
Definition gnssrtk2.h:205
digital_out_t rst
Definition gnssrtk2.h:189
digital_in_t rtk
Definition gnssrtk2.h:192
uint8_t slave_address
Definition gnssrtk2.h:203
digital_in_t tmp
Definition gnssrtk2.h:193
pin_name_t chip_select
Definition gnssrtk2.h:204
char uart_tx_buffer[DRV_TX_BUFFER_SIZE]
Definition gnssrtk2.h:201
digital_in_t rdy
Definition gnssrtk2.h:191