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"
74#define GNSSRTK3_RSP_START "$"
75#define GNSSRTK3_RSP_DELIMITER ","
76#define GNSSRTK3_RSP_END "\r\n"
77#define GNSSRTK3_RSP_GGA "GGA"
83#define GNSSRTK3_GGA_ELEMENT_SIZE 15
84#define GNSSRTK3_GGA_TIME 1
85#define GNSSRTK3_GGA_LATITUDE 2
86#define GNSSRTK3_GGA_LATITUDE_SIDE 3
87#define GNSSRTK3_GGA_LONGITUDE 4
88#define GNSSRTK3_GGA_LONGITUDE_SIDE 5
89#define GNSSRTK3_GGA_QUALITY_INDICATOR 6
90#define GNSSRTK3_GGA_NUMBER_OF_SATELLITES 7
91#define GNSSRTK3_GGA_H_DILUTION_OF_POS 8
92#define GNSSRTK3_GGA_ALTITUDE 9
93#define GNSSRTK3_GGA_ALTITUDE_UNIT 10
94#define GNSSRTK3_GGA_GEOIDAL_SEPARATION 11
95#define GNSSRTK3_GGA_GEOIDAL_SEPARATION_UNIT 12
96#define GNSSRTK3_GGA_TIME_SINCE_LAST_DGPS 13
97#define GNSSRTK3_GGA_DGPS_REFERENCE_STATION_ID 14
103#define GNSSRTK3_I2C_SLAVE_CR_CMD 0xAA51u
104#define GNSSRTK3_I2C_SLAVE_CW_CMD 0xAA53u
105#define GNSSRTK3_I2C_SLAVE_CMD_LEN 8
106#define GNSSRTK3_I2C_SLAVE_RX_LEN 4
107#define GNSSRTK3_I2C_SLAVE_TX_LEN_REG_OFFSET 0x0008u
108#define GNSSRTK3_I2C_SLAVE_TX_BUF_REG_OFFSET 0x2000u
109#define GNSSRTK3_I2C_SLAVE_RX_LEN_REG_OFFSET 0x0004u
110#define GNSSRTK3_I2C_SLAVE_RX_BUF_REG_OFFSET 0x1000u
111#define GNSSRTK3_I2C_SLAVE_ADDRESS_CR_OR_CW 0x50
112#define GNSSRTK3_I2C_SLAVE_ADDRESS_R 0x54
113#define GNSSRTK3_I2C_SLAVE_ADDRESS_W 0x58
114#define GNSSRTK3_I2C_SLAVE_MAX_ERRORS 10
121#define GNSSRTK3_TX_DRV_BUFFER_SIZE 100
122#define GNSSRTK3_RX_DRV_BUFFER_SIZE 1000u
140#define GNSSRTK3_MAP_MIKROBUS( cfg, mikrobus ) \
141 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
142 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
143 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
144 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
145 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
146 cfg.cen = MIKROBUS( mikrobus, MIKROBUS_CS ); \
147 cfg.wup = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
148 cfg.pps = MIKROBUS( mikrobus, MIKROBUS_INT );
gnssrtk3_return_value_t
GNSS RTK 3 Click return value data.
Definition gnssrtk3.h:228
@ GNSSRTK3_ERROR
Definition gnssrtk3.h:230
@ GNSSRTK3_OK
Definition gnssrtk3.h:229
gnssrtk3_drv_t
GNSS RTK 3 Click driver selector.
Definition gnssrtk3.h:158
@ GNSSRTK3_DRV_SEL_UART
Definition gnssrtk3.h:159
@ GNSSRTK3_DRV_SEL_I2C
Definition gnssrtk3.h:160
err_t(* gnssrtk3_master_io_t)(struct gnssrtk3_s *, uint8_t *, uint16_t)
Definition gnssrtk3.h:169
struct gnssrtk3_s gnssrtk3_t
GNSS RTK 3 Click context object.
#define GNSSRTK3_TX_DRV_BUFFER_SIZE
GNSS RTK 3 driver buffer size.
Definition gnssrtk3.h:121
#define GNSSRTK3_RX_DRV_BUFFER_SIZE
Definition gnssrtk3.h:122
void gnssrtk3_set_wup_pin(gnssrtk3_t *ctx, uint8_t state)
GNSS RTK 3 set WUP pin function.
err_t gnssrtk3_generic_write(gnssrtk3_t *ctx, uint8_t *data_in, uint16_t len)
GNSS RTK 3 data writing function.
void gnssrtk3_cfg_setup(gnssrtk3_cfg_t *cfg)
GNSS RTK 3 configuration object setup function.
void gnssrtk3_set_cen_pin(gnssrtk3_t *ctx, uint8_t state)
GNSS RTK 3 set CEN pin function.
err_t gnssrtk3_init(gnssrtk3_t *ctx, gnssrtk3_cfg_t *cfg)
GNSS RTK 3 initialization function.
void gnssrtk3_reset_device(gnssrtk3_t *ctx)
GNSS RTK 3 reset device function.
err_t gnssrtk3_generic_read(gnssrtk3_t *ctx, uint8_t *data_out, uint16_t len)
GNSS RTK 3 data reading function.
void gnssrtk3_disable_device(gnssrtk3_t *ctx)
GNSS RTK 3 disable device function.
void gnssrtk3_drv_interface_sel(gnssrtk3_cfg_t *cfg, gnssrtk3_drv_t drv_sel)
GNSS RTK 3 driver interface setup function.
void gnssrtk3_enable_device(gnssrtk3_t *ctx)
GNSS RTK 3 enable device function.
err_t gnssrtk3_parse_gga(uint8_t *rsp_buf, uint8_t gga_element, uint8_t *element_data)
GNSS RTK 3 parse GGA function.
void gnssrtk3_set_rst_pin(gnssrtk3_t *ctx, uint8_t state)
GNSS RTK 3 set RST pin function.
uint8_t gnssrtk3_get_pps_pin(gnssrtk3_t *ctx)
GNSS RTK 3 get PPS pin function.
GNSS RTK 3 Click configuration object.
Definition gnssrtk3.h:200
uint32_t baud_rate
Definition gnssrtk3.h:213
pin_name_t wup
Definition gnssrtk3.h:207
pin_name_t pps
Definition gnssrtk3.h:208
uint32_t i2c_speed
Definition gnssrtk3.h:210
pin_name_t cen
Definition gnssrtk3.h:206
bool uart_blocking
Definition gnssrtk3.h:214
uart_data_bits_t data_bit
Definition gnssrtk3.h:215
gnssrtk3_drv_t drv_sel
Definition gnssrtk3.h:219
pin_name_t tx_pin
Definition gnssrtk3.h:204
pin_name_t rx_pin
Definition gnssrtk3.h:203
uart_stop_bits_t stop_bit
Definition gnssrtk3.h:217
pin_name_t scl
Definition gnssrtk3.h:201
uart_parity_t parity_bit
Definition gnssrtk3.h:216
pin_name_t sda
Definition gnssrtk3.h:202
pin_name_t rst
Definition gnssrtk3.h:205
uint8_t i2c_address
Definition gnssrtk3.h:211
GNSS RTK 3 Click context object.
Definition gnssrtk3.h:176
uint8_t uart_rx_buffer[GNSSRTK3_RX_DRV_BUFFER_SIZE]
Definition gnssrtk3.h:185
gnssrtk3_master_io_t write_f
Definition gnssrtk3.h:190
digital_in_t pps
Definition gnssrtk3.h:180
uint8_t uart_tx_buffer[GNSSRTK3_TX_DRV_BUFFER_SIZE]
Definition gnssrtk3.h:186
uart_t uart
Definition gnssrtk3.h:182
gnssrtk3_drv_t drv_sel
Definition gnssrtk3.h:188
digital_out_t cen
Definition gnssrtk3.h:178
i2c_master_t i2c
Definition gnssrtk3.h:183
digital_out_t wup
Definition gnssrtk3.h:179
digital_out_t rst
Definition gnssrtk3.h:177
gnssrtk3_master_io_t read_f
Definition gnssrtk3.h:191