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 GNSS11_RSP_START "$"
77#define GNSS11_RSP_DELIMITER ","
78#define GNSS11_RSP_END "\r\n"
79#define GNSS11_RSP_GGA "GGA"
85#define GNSS11_GGA_ELEMENT_SIZE 15
86#define GNSS11_GGA_TIME 1
87#define GNSS11_GGA_LATITUDE 2
88#define GNSS11_GGA_LATITUDE_SIDE 3
89#define GNSS11_GGA_LONGITUDE 4
90#define GNSS11_GGA_LONGITUDE_SIDE 5
91#define GNSS11_GGA_QUALITY_INDICATOR 6
92#define GNSS11_GGA_NUMBER_OF_SATELLITES 7
93#define GNSS11_GGA_H_DILUTION_OF_POS 8
94#define GNSS11_GGA_ALTITUDE 9
95#define GNSS11_GGA_ALTITUDE_UNIT 10
96#define GNSS11_GGA_GEOIDAL_SEPARATION 11
97#define GNSS11_GGA_GEOIDAL_SEPARATION_UNIT 12
98#define GNSS11_GGA_TIME_SINCE_LAST_DGPS 13
99#define GNSS11_GGA_DGPS_REFERENCE_STATION_ID 14
105#define GNSS11_DUMMY 0xFF
112#define GNSS11_SET_DEV_ADDR 0x42
119#define GNSS11_TX_DRV_BUFFER_SIZE 100
120#define GNSS11_RX_DRV_BUFFER_SIZE 1000
130#define GNSS11_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
131#define GNSS11_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
149#define GNSS11_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
151 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
152 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
153 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
154 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
155 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
156 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
157 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
158 cfg.ovc = MIKROBUS( mikrobus, MIKROBUS_AN ); \
159 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
160 cfg.ant_on = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
161 cfg.eint = MIKROBUS( mikrobus, MIKROBUS_INT );
err_t(* gnss11_master_io_t)(struct gnss11_s *, uint8_t *, uint16_t)
Definition gnss11.h:183
gnss11_return_value_t
GNSS 11 Click return value data.
Definition gnss11.h:254
@ GNSS11_OK
Definition gnss11.h:255
@ GNSS11_ERROR
Definition gnss11.h:256
gnss11_drv_t
GNSS 11 Click driver selector.
Definition gnss11.h:171
@ GNSS11_DRV_SEL_UART
Definition gnss11.h:172
@ GNSS11_DRV_SEL_SPI
Definition gnss11.h:173
@ GNSS11_DRV_SEL_I2C
Definition gnss11.h:174
struct gnss11_s gnss11_t
GNSS 11 Click context object.
#define GNSS11_TX_DRV_BUFFER_SIZE
GNSS 11 driver buffer size.
Definition gnss11.h:119
#define GNSS11_RX_DRV_BUFFER_SIZE
Definition gnss11.h:120
uint8_t gnss11_get_ovc_pin(gnss11_t *ctx)
GNSS 11 get OVC pin function.
err_t gnss11_default_cfg(gnss11_t *ctx)
GNSS 11 default configuration function.
err_t gnss11_parse_gga(uint8_t *rsp_buf, uint8_t gga_element, uint8_t *element_data)
GNSS 11 parse GGA function.
void gnss11_set_ant_on_pin(gnss11_t *ctx, uint8_t state)
GNSS 11 set ANT_ON pin function.
void gnss11_drv_interface_selection(gnss11_cfg_t *cfg, gnss11_drv_t drv_sel)
GNSS 11 driver interface setup function.
void gnss11_cfg_setup(gnss11_cfg_t *cfg)
GNSS 11 configuration object setup function.
void gnss11_reset_device(gnss11_t *ctx)
GNSS 11 reset device function.
uint8_t gnss11_get_eint_pin(gnss11_t *ctx)
GNSS 11 get Ext INT pin function.
void gnss11_set_rst_pin(gnss11_t *ctx, uint8_t state)
GNSS 11 set RST pin function.
err_t gnss11_generic_read(gnss11_t *ctx, uint8_t *data_out, uint16_t len)
GNSS 11 data reading function.
err_t gnss11_generic_write(gnss11_t *ctx, uint8_t *data_in, uint16_t len)
GNSS 11 data writing function.
err_t gnss11_init(gnss11_t *ctx, gnss11_cfg_t *cfg)
GNSS 11 initialization function.
This file contains SPI specific macros, functions, etc.
GNSS 11 Click configuration object.
Definition gnss11.h:218
uint32_t baud_rate
Definition gnss11.h:239
uint32_t i2c_speed
Definition gnss11.h:232
gnss11_drv_t drv_sel
Definition gnss11.h:245
spi_master_chip_select_polarity_t cs_polarity
Definition gnss11.h:237
bool uart_blocking
Definition gnss11.h:240
pin_name_t sck
Definition gnss11.h:223
uart_data_bits_t data_bit
Definition gnss11.h:241
spi_master_mode_t spi_mode
Definition gnss11.h:236
pin_name_t tx_pin
Definition gnss11.h:226
pin_name_t mosi
Definition gnss11.h:222
uint32_t spi_speed
Definition gnss11.h:235
pin_name_t ovc
Definition gnss11.h:230
pin_name_t ant_on
Definition gnss11.h:228
pin_name_t eint
Definition gnss11.h:229
pin_name_t rx_pin
Definition gnss11.h:225
uart_stop_bits_t stop_bit
Definition gnss11.h:243
pin_name_t scl
Definition gnss11.h:219
pin_name_t miso
Definition gnss11.h:221
uart_parity_t parity_bit
Definition gnss11.h:242
pin_name_t sda
Definition gnss11.h:220
pin_name_t rst
Definition gnss11.h:227
pin_name_t cs
Definition gnss11.h:224
uint8_t i2c_address
Definition gnss11.h:233
GNSS 11 Click context object.
Definition gnss11.h:190
spi_master_t spi
Definition gnss11.h:198
digital_in_t ovc
Definition gnss11.h:195
gnss11_master_io_t read_f
Definition gnss11.h:209
gnss11_drv_t drv_sel
Definition gnss11.h:206
uart_t uart
Definition gnss11.h:199
i2c_master_t i2c
Definition gnss11.h:197
uint8_t uart_rx_buffer[GNSS11_RX_DRV_BUFFER_SIZE]
Definition gnss11.h:201
gnss11_master_io_t write_f
Definition gnss11.h:208
uint8_t uart_tx_buffer[GNSS11_TX_DRV_BUFFER_SIZE]
Definition gnss11.h:202
digital_out_t rst
Definition gnss11.h:191
digital_in_t eint
Definition gnss11.h:194
uint8_t slave_address
Definition gnss11.h:204
pin_name_t chip_select
Definition gnss11.h:205
digital_out_t ant_on
Definition gnss11.h:192