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 GNSS10_RSP_START "$"
77#define GNSS10_RSP_DELIMITER ","
78#define GNSS10_RSP_GNGGA "$GNGGA"
84#define GNSS10_GNGGA_ELEMENT_SIZE 15
85#define GNSS10_GNGGA_TIME 1
86#define GNSS10_GNGGA_LATITUDE 2
87#define GNSS10_GNGGA_LATITUDE_SIDE 3
88#define GNSS10_GNGGA_LONGITUDE 4
89#define GNSS10_GNGGA_LONGITUDE_SIDE 5
90#define GNSS10_GNGGA_QUALITY_INDICATOR 6
91#define GNSS10_GNGGA_NUMBER_OF_SATELLITES 7
92#define GNSS10_GNGGA_H_DILUTION_OF_POS 8
93#define GNSS10_GNGGA_ALTITUDE 9
94#define GNSS10_GNGGA_ALTITUDE_UNIT 10
95#define GNSS10_GNGGA_GEOIDAL_SEPARATION 11
96#define GNSS10_GNGGA_GEOIDAL_SEPARATION_UNIT 12
97#define GNSS10_GNGGA_TIME_SINCE_LAST_DGPS 13
98#define GNSS10_GNGGA_DGPS_REFERENCE_STATION_ID 14
104#define GNSS10_DUMMY 0xFF
111#define GNSS10_SET_DEV_ADDR 0x42
118#define DRV_BUFFER_SIZE 200
128#define GNSS10_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
129#define GNSS10_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
147#define GNSS10_MAP_MIKROBUS( cfg, mikrobus ) \
148 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
149 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
150 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
151 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
152 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
153 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
154 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
155 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
156 cfg.eint_1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
157 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
158 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
gnss10_drv_t
GNSS 10 Click driver selector.
Definition gnss10.h:168
@ GNSS10_DRV_SEL_UART
Definition gnss10.h:169
@ GNSS10_DRV_SEL_I2C
Definition gnss10.h:171
@ GNSS10_DRV_SEL_SPI
Definition gnss10.h:170
struct gnss10_s gnss10_t
GNSS 10 Click context object.
gnss10_return_value_t
GNSS 10 Click return value data.
Definition gnss10.h:249
@ GNSS10_ERROR
Definition gnss10.h:251
@ GNSS10_OK
Definition gnss10.h:250
err_t(* gnss10_master_io_t)(struct gnss10_s *, uint8_t *, uint8_t)
GNSS 10 Click driver interface.
Definition gnss10.h:179
#define DRV_BUFFER_SIZE
GNSS 10 driver buffer size.
Definition gnss10.h:118
err_t gnss10_parse_gngga(char *rsp_buf, uint8_t gngga_element, char *element_data)
GNSS 10 parse GNGGA function.
err_t gnss10_init(gnss10_t *ctx, gnss10_cfg_t *cfg)
GNSS 10 initialization function.
uint8_t gnss10_get_int_pin(gnss10_t *ctx)
GNSS 10 get INT pin function.
void gnss10_reset_device(gnss10_t *ctx)
GNSS 10 reset device function.
uint8_t gnss10_get_eint_1_pin(gnss10_t *ctx)
GNSS 10 get Ext INT 1 pin function.
err_t gnss10_generic_write(gnss10_t *ctx, uint8_t *data_in, uint8_t len)
GNSS 10 data writing function.
void gnss10_set_rst_pin(gnss10_t *ctx, uint8_t state)
GNSS 10 set RST pin function.
void gnss10_drv_interface_selection(gnss10_cfg_t *cfg, gnss10_drv_t drv_sel)
GNSS 10 driver interface setup function.
void gnss10_cfg_setup(gnss10_cfg_t *cfg)
GNSS 10 configuration object setup function.
err_t gnss10_generic_read(gnss10_t *ctx, uint8_t *data_out, uint8_t len)
GNSS 10 data reading function.
This file contains SPI specific macros, functions, etc.
GNSS 10 Click configuration object.
Definition gnss10.h:214
uint32_t baud_rate
Definition gnss10.h:234
pin_name_t eint_1
Definition gnss10.h:223
gnss10_drv_t drv_sel
Definition gnss10.h:240
uint32_t i2c_speed
Definition gnss10.h:227
spi_master_chip_select_polarity_t cs_polarity
Definition gnss10.h:232
bool uart_blocking
Definition gnss10.h:235
pin_name_t sck
Definition gnss10.h:219
uart_data_bits_t data_bit
Definition gnss10.h:236
spi_master_mode_t spi_mode
Definition gnss10.h:231
pin_name_t tx_pin
Definition gnss10.h:222
pin_name_t mosi
Definition gnss10.h:218
uint32_t spi_speed
Definition gnss10.h:230
pin_name_t rx_pin
Definition gnss10.h:221
uart_stop_bits_t stop_bit
Definition gnss10.h:238
pin_name_t scl
Definition gnss10.h:215
pin_name_t int_pin
Definition gnss10.h:225
pin_name_t miso
Definition gnss10.h:217
uart_parity_t parity_bit
Definition gnss10.h:237
pin_name_t sda
Definition gnss10.h:216
pin_name_t rst
Definition gnss10.h:224
pin_name_t cs
Definition gnss10.h:220
uint8_t i2c_address
Definition gnss10.h:228
GNSS 10 Click context object.
Definition gnss10.h:186
char uart_tx_buffer[DRV_BUFFER_SIZE]
Definition gnss10.h:198
spi_master_t spi
Definition gnss10.h:193
gnss10_master_io_t read_f
Definition gnss10.h:205
gnss10_drv_t drv_sel
Definition gnss10.h:202
gnss10_master_io_t write_f
Definition gnss10.h:204
uart_t uart
Definition gnss10.h:194
digital_in_t int_pin
Definition gnss10.h:190
i2c_master_t i2c
Definition gnss10.h:192
digital_in_t eint_1
Definition gnss10.h:189
digital_out_t rst
Definition gnss10.h:187
uint8_t slave_address
Definition gnss10.h:200
char uart_rx_buffer[DRV_BUFFER_SIZE]
Definition gnss10.h:197
pin_name_t chip_select
Definition gnss10.h:201