gnss8 2.0.0.0
gnss8.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef GNSS8_H
29#define GNSS8_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37#include "drv_uart.h"
38
54#define DRV_BUFFER_SIZE_TX 100
55#define DRV_BUFFER_SIZE_RX 700
56 // gnss8_set
58
73#define GNSS8_MAP_MIKROBUS( cfg, mikrobus ) \
74 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
75 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
76 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_AN ); \
77 cfg.req = MIKROBUS( mikrobus, MIKROBUS_RST ); \
78 cfg.apr = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
79 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
80 // gnss8_map // gnss8
83
88typedef struct
89{
90 // Output pins
91 digital_out_t apr;
93 // Input pins
94 digital_in_t rdy;
95 digital_in_t req;
96 digital_in_t int_pin;
98 // Modules
99 uart_t uart;
101 // Buffers
102 char uart_rx_buffer[ DRV_BUFFER_SIZE_RX ];
103 char uart_tx_buffer[ DRV_BUFFER_SIZE_TX ];
105} gnss8_t;
106
111typedef struct
112{
113 // Communication gpio pins
114 pin_name_t rx_pin;
115 pin_name_t tx_pin;
117 // Additional gpio pins
118 pin_name_t rdy;
119 pin_name_t req;
120 pin_name_t apr;
121 pin_name_t int_pin;
123 // Static variable
124 uint32_t baud_rate;
126 uart_data_bits_t data_bit;
127 uart_parity_t parity_bit;
128 uart_stop_bits_t stop_bit;
131
136typedef enum
137{
142
144
161
176err_t gnss8_init ( gnss8_t *ctx, gnss8_cfg_t *cfg );
177
191err_t gnss8_generic_write ( gnss8_t *ctx, char *data_buf, uint16_t len );
192
206err_t gnss8_generic_read ( gnss8_t *ctx, char *data_buf, uint16_t max_len );
207
215void gnss8_set_ap_req ( gnss8_t *ctx, uint8_t state );
216
224uint8_t gnss8_get_req ( gnss8_t *ctx );
225
233uint8_t gnss8_get_int ( gnss8_t *ctx );
234
242uint8_t gnss8_get_rdy ( gnss8_t *ctx );
243
244#ifdef __cplusplus
245}
246#endif
247#endif // GNSS8_H
248 // gnss8
250
251// ------------------------------------------------------------------------ END
gnss8_return_value_t
GNSS 8 Click return value data.
Definition: gnss8.h:137
@ GNSS8_ERROR_OVERFLOW
Definition: gnss8.h:141
@ GNSS8_OK
Definition: gnss8.h:138
@ GNSS8_ERROR_NO_DATA
Definition: gnss8.h:140
@ GNSS8_ERROR
Definition: gnss8.h:139
#define DRV_BUFFER_SIZE_TX
GNSS 8 driver buffer size.
Definition: gnss8.h:54
#define DRV_BUFFER_SIZE_RX
Definition: gnss8.h:55
void gnss8_set_ap_req(gnss8_t *ctx, uint8_t state)
Set AP request pin state.
void gnss8_cfg_setup(gnss8_cfg_t *cfg)
GNSS 8 configuration object setup function.
err_t gnss8_init(gnss8_t *ctx, gnss8_cfg_t *cfg)
GNSS 8 initialization function.
uint8_t gnss8_get_rdy(gnss8_t *ctx)
Get ready pin state.
err_t gnss8_generic_write(gnss8_t *ctx, char *data_buf, uint16_t len)
Data writing function.
err_t gnss8_generic_read(gnss8_t *ctx, char *data_buf, uint16_t max_len)
Data reading function.
uint8_t gnss8_get_req(gnss8_t *ctx)
Get request pin state.
uint8_t gnss8_get_int(gnss8_t *ctx)
Get interrupt pin state.
GNSS 8 Click configuration object.
Definition: gnss8.h:112
uint32_t baud_rate
Definition: gnss8.h:124
bool uart_blocking
Definition: gnss8.h:125
pin_name_t req
Definition: gnss8.h:119
uart_data_bits_t data_bit
Definition: gnss8.h:126
pin_name_t tx_pin
Definition: gnss8.h:115
pin_name_t rx_pin
Definition: gnss8.h:114
uart_stop_bits_t stop_bit
Definition: gnss8.h:128
pin_name_t int_pin
Definition: gnss8.h:121
pin_name_t rdy
Definition: gnss8.h:118
uart_parity_t parity_bit
Definition: gnss8.h:127
pin_name_t apr
Definition: gnss8.h:120
GNSS 8 Click context object.
Definition: gnss8.h:89
digital_out_t apr
Definition: gnss8.h:91
uart_t uart
Definition: gnss8.h:99
digital_in_t int_pin
Definition: gnss8.h:96
digital_in_t req
Definition: gnss8.h:95
digital_in_t rdy
Definition: gnss8.h:94