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 GNSSRTK_RSP_START "$"
77#define GNSSRTK_RSP_DELIMITER ","
78#define GNSSRTK_RSP_GNGGA "$GNGGA"
84#define GNSSRTK_GNGGA_ELEMENT_SIZE 15
85#define GNSSRTK_GNGGA_TIME 1
86#define GNSSRTK_GNGGA_LATITUDE 2
87#define GNSSRTK_GNGGA_LATITUDE_SIDE 3
88#define GNSSRTK_GNGGA_LONGITUDE 4
89#define GNSSRTK_GNGGA_LONGITUDE_SIDE 5
90#define GNSSRTK_GNGGA_QUALITY_INDICATOR 6
91#define GNSSRTK_GNGGA_NUMBER_OF_SATELLITES 7
92#define GNSSRTK_GNGGA_H_DILUTION_OF_POS 8
93#define GNSSRTK_GNGGA_ALTITUDE 9
94#define GNSSRTK_GNGGA_ALTITUDE_UNIT 10
95#define GNSSRTK_GNGGA_GEOIDAL_SEPARATION 11
96#define GNSSRTK_GNGGA_GEOIDAL_SEPARATION_UNIT 12
97#define GNSSRTK_GNGGA_TIME_SINCE_LAST_DGPS 13
98#define GNSSRTK_GNGGA_DGPS_REFERENCE_STATION_ID 14
104#define GNSSRTK_DUMMY 0xFF
111#define GNSSRTK_SET_DEV_ADDR 0x42
118#define GNSSRTK_DRV_TX_BUFFER_SIZE 100
119#define GNSSRTK_DRV_RX_BUFFER_SIZE 300
129#define GNSSRTK_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
130#define GNSSRTK_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
148#define GNSSRTK_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 )
err_t(* gnssrtk_master_io_t)(struct gnssrtk_s *, uint8_t *, uint8_t)
GNSS RTK Click driver interface.
Definition gnssrtk.h:181
gnssrtk_drv_t
GNSS RTK Click driver selector.
Definition gnssrtk.h:170
@ GNSSRTK_DRV_SEL_I2C
Definition gnssrtk.h:173
@ GNSSRTK_DRV_SEL_SPI
Definition gnssrtk.h:172
@ GNSSRTK_DRV_SEL_UART
Definition gnssrtk.h:171
struct gnssrtk_s gnssrtk_t
GNSS RTK Click context object.
gnssrtk_return_value_t
GNSS RTK Click return value data.
Definition gnssrtk.h:254
@ GNSSRTK_ERROR
Definition gnssrtk.h:256
@ GNSSRTK_OK
Definition gnssrtk.h:255
#define GNSSRTK_DRV_RX_BUFFER_SIZE
Definition gnssrtk.h:119
#define GNSSRTK_DRV_TX_BUFFER_SIZE
GNSS RTK driver buffer size.
Definition gnssrtk.h:118
void gnssrtk_cfg_setup(gnssrtk_cfg_t *cfg)
GNSS RTK configuration object setup function.
void gnssrtk_set_rst_pin(gnssrtk_t *ctx, uint8_t state)
GNSS RTK set RST pin function.
uint8_t gnssrtk_get_rdy_pin(gnssrtk_t *ctx)
GNSS RTK get RDY pin function.
void gnssrtk_reset_device(gnssrtk_t *ctx)
GNSS RTK reset device function.
err_t gnssrtk_parse_gngga(char *rsp_buf, uint8_t gngga_element, char *element_data)
GNSS RTK parse GNGGA function.
err_t gnssrtk_init(gnssrtk_t *ctx, gnssrtk_cfg_t *cfg)
GNSS RTK initialization function.
uint8_t gnssrtk_get_tmp_pin(gnssrtk_t *ctx)
GNSS RTK get TMP pin function.
void gnssrtk_drv_interface_selection(gnssrtk_cfg_t *cfg, gnssrtk_drv_t drv_sel)
GNSS RTK driver interface setup function.
uint8_t gnssrtk_get_rtk_pin(gnssrtk_t *ctx)
GNSS RTK get RTK pin function.
err_t gnssrtk_generic_write(gnssrtk_t *ctx, uint8_t *data_in, uint8_t len)
GNSS RTK data writing function.
err_t gnssrtk_generic_read(gnssrtk_t *ctx, uint8_t *data_out, uint8_t len)
GNSS RTK data reading function.
This file contains SPI specific macros, functions, etc.
GNSS RTK Click configuration object.
Definition gnssrtk.h:217
uint32_t baud_rate
Definition gnssrtk.h:239
pin_name_t tmp
Definition gnssrtk.h:230
gnssrtk_drv_t drv_sel
Definition gnssrtk.h:245
uint32_t i2c_speed
Definition gnssrtk.h:232
spi_master_chip_select_polarity_t cs_polarity
Definition gnssrtk.h:237
bool uart_blocking
Definition gnssrtk.h:240
pin_name_t sck
Definition gnssrtk.h:222
uart_data_bits_t data_bit
Definition gnssrtk.h:241
spi_master_mode_t spi_mode
Definition gnssrtk.h:236
pin_name_t tx_pin
Definition gnssrtk.h:225
pin_name_t mosi
Definition gnssrtk.h:221
uint32_t spi_speed
Definition gnssrtk.h:235
pin_name_t rtk
Definition gnssrtk.h:228
pin_name_t rx_pin
Definition gnssrtk.h:224
uart_stop_bits_t stop_bit
Definition gnssrtk.h:243
pin_name_t scl
Definition gnssrtk.h:218
pin_name_t rdy
Definition gnssrtk.h:227
pin_name_t miso
Definition gnssrtk.h:220
uart_parity_t parity_bit
Definition gnssrtk.h:242
pin_name_t sda
Definition gnssrtk.h:219
pin_name_t rst
Definition gnssrtk.h:229
pin_name_t cs
Definition gnssrtk.h:223
uint8_t i2c_address
Definition gnssrtk.h:233
GNSS RTK Click context object.
Definition gnssrtk.h:188
spi_master_t spi
Definition gnssrtk.h:196
char uart_tx_buffer[GNSSRTK_DRV_TX_BUFFER_SIZE]
Definition gnssrtk.h:201
gnssrtk_drv_t drv_sel
Definition gnssrtk.h:205
gnssrtk_master_io_t write_f
Definition gnssrtk.h:207
uart_t uart
Definition gnssrtk.h:197
i2c_master_t i2c
Definition gnssrtk.h:195
char uart_rx_buffer[GNSSRTK_DRV_RX_BUFFER_SIZE]
Definition gnssrtk.h:200
digital_out_t rst
Definition gnssrtk.h:189
digital_in_t rtk
Definition gnssrtk.h:192
uint8_t slave_address
Definition gnssrtk.h:203
digital_in_t tmp
Definition gnssrtk.h:193
gnssrtk_master_io_t read_f
Definition gnssrtk.h:208
pin_name_t chip_select
Definition gnssrtk.h:204
digital_in_t rdy
Definition gnssrtk.h:191