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 GNSS12_RSP_START "$"
77#define GNSS12_RSP_DELIMITER ","
78#define GNSS12_RSP_GNGGA "$GNGGA"
84#define GNSS12_GNGGA_ELEMENT_SIZE 15
85#define GNSS12_GNGGA_TIME 1
86#define GNSS12_GNGGA_LATITUDE 2
87#define GNSS12_GNGGA_LATITUDE_SIDE 3
88#define GNSS12_GNGGA_LONGITUDE 4
89#define GNSS12_GNGGA_LONGITUDE_SIDE 5
90#define GNSS12_GNGGA_QUALITY_INDICATOR 6
91#define GNSS12_GNGGA_NUMBER_OF_SATELLITES 7
92#define GNSS12_GNGGA_H_DILUTION_OF_POS 8
93#define GNSS12_GNGGA_ALTITUDE 9
94#define GNSS12_GNGGA_ALTITUDE_UNIT 10
95#define GNSS12_GNGGA_GEOIDAL_SEPARATION 11
96#define GNSS12_GNGGA_GEOIDAL_SEPARATION_UNIT 12
97#define GNSS12_GNGGA_TIME_SINCE_LAST_DGPS 13
98#define GNSS12_GNGGA_DGPS_REFERENCE_STATION_ID 14
104#define GNSS12_DUMMY 0xFF
111#define GNSS12_SET_DEV_ADDR 0x42
118#define GNSS12_DRV_BUFFER_SIZE 200
128#define GNSS12_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
129#define GNSS12_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
147#define GNSS12_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.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
157 cfg.lna_en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
158 cfg.eint = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t(* gnss12_master_io_t)(struct gnss12_s *, uint8_t *, uint8_t)
GNSS 12 Click driver interface.
Definition gnss12.h:179
gnss12_drv_t
GNSS 12 Click driver selector.
Definition gnss12.h:168
@ GNSS12_DRV_SEL_UART
Definition gnss12.h:169
@ GNSS12_DRV_SEL_SPI
Definition gnss12.h:170
@ GNSS12_DRV_SEL_I2C
Definition gnss12.h:171
struct gnss12_s gnss12_t
GNSS 12 Click context object.
gnss12_return_value_t
GNSS 12 Click return value data.
Definition gnss12.h:249
@ GNSS12_OK
Definition gnss12.h:250
@ GNSS12_ERROR
Definition gnss12.h:251
#define GNSS12_DRV_BUFFER_SIZE
GNSS 12 driver buffer size.
Definition gnss12.h:118
void gnss12_set_rst_pin(gnss12_t *ctx, uint8_t state)
GNSS 12 set RST pin function.
uint8_t gnss12_get_eint_pin(gnss12_t *ctx)
GNSS 12 get Ext INT pin function.
err_t gnss12_parse_gngga(char *rsp_buf, uint8_t gngga_element, char *element_data)
GNSS 12 parse GNGGA function.
err_t gnss12_init(gnss12_t *ctx, gnss12_cfg_t *cfg)
GNSS 12 initialization function.
uint8_t gnss12_get_lna_en_pin(gnss12_t *ctx)
GNSS 12 get LNA EN pin function.
err_t gnss12_generic_write(gnss12_t *ctx, uint8_t *data_in, uint8_t len)
GNSS 12 data writing function.
void gnss12_drv_interface_selection(gnss12_cfg_t *cfg, gnss12_drv_t drv_sel)
GNSS 12 driver interface setup function.
err_t gnss12_generic_read(gnss12_t *ctx, uint8_t *data_out, uint8_t len)
GNSS 12 data reading function.
void gnss12_reset_device(gnss12_t *ctx)
GNSS 12 reset device function.
void gnss12_cfg_setup(gnss12_cfg_t *cfg)
GNSS 12 configuration object setup function.
This file contains SPI specific macros, functions, etc.
GNSS 12 Click configuration object.
Definition gnss12.h:214
uint32_t baud_rate
Definition gnss12.h:234
gnss12_drv_t drv_sel
Definition gnss12.h:240
uint32_t i2c_speed
Definition gnss12.h:227
spi_master_chip_select_polarity_t cs_polarity
Definition gnss12.h:232
bool uart_blocking
Definition gnss12.h:235
pin_name_t sck
Definition gnss12.h:219
uart_data_bits_t data_bit
Definition gnss12.h:236
spi_master_mode_t spi_mode
Definition gnss12.h:231
pin_name_t lna_en
Definition gnss12.h:224
pin_name_t tx_pin
Definition gnss12.h:222
pin_name_t mosi
Definition gnss12.h:218
uint32_t spi_speed
Definition gnss12.h:230
pin_name_t eint
Definition gnss12.h:225
pin_name_t rx_pin
Definition gnss12.h:221
uart_stop_bits_t stop_bit
Definition gnss12.h:238
pin_name_t scl
Definition gnss12.h:215
pin_name_t miso
Definition gnss12.h:217
uart_parity_t parity_bit
Definition gnss12.h:237
pin_name_t sda
Definition gnss12.h:216
pin_name_t rst
Definition gnss12.h:223
pin_name_t cs
Definition gnss12.h:220
uint8_t i2c_address
Definition gnss12.h:228
GNSS 12 Click context object.
Definition gnss12.h:186
spi_master_t spi
Definition gnss12.h:193
gnss12_drv_t drv_sel
Definition gnss12.h:202
gnss12_master_io_t read_f
Definition gnss12.h:205
char uart_tx_buffer[GNSS12_DRV_BUFFER_SIZE]
Definition gnss12.h:198
char uart_rx_buffer[GNSS12_DRV_BUFFER_SIZE]
Definition gnss12.h:197
uart_t uart
Definition gnss12.h:194
i2c_master_t i2c
Definition gnss12.h:192
digital_in_t lna_en
Definition gnss12.h:190
digital_out_t rst
Definition gnss12.h:187
digital_in_t eint
Definition gnss12.h:189
uint8_t slave_address
Definition gnss12.h:200
gnss12_master_io_t write_f
Definition gnss12.h:204
pin_name_t chip_select
Definition gnss12.h:201