42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
67#define GSMGNSS_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.det = MIKROBUS( mikrobus, MIKROBUS_AN ); \
71 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
72 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.ring = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
74 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
81#define GSMGNSS_RETVAL uint8_t
88#define GSMGNSS_NMEA_GNGGA 1
89#define GSMGNSS_NMEA_GNGLL 3
90#define GSMGNSS_NMEA_GNGGA_NUM_ELEMENT 15
91#define GSMGNSS_NMEA_GNGLL_NUM_ELEMENT 5
98#define GSMGNSS_GNGGA_TIME 1
99#define GSMGNSS_GNGGA_LATITUDE 2
100#define GSMGNSS_GNGGA_LATITUDE_SIDE 3
101#define GSMGNSS_GNGGA_LONGITUDE 4
102#define GSMGNSS_GNGGA_LONGITUDE_SIDE 5
103#define GSMGNSS_GNGGA_QUALITY_INDICATOR 6
104#define GSMGNSS_GNGGA_NUMBER_OF_SATELLITES 7
105#define GSMGNSS_GNGGA_H_DILUTION_OF_POS 8
106#define GSMGNSS_GNGGA_ALTITUDE 9
107#define GSMGNSS_GNGGA_ALTITUDE_UNIT 10
108#define GSMGNSS_GNGGA_GEOIDAL_SEPARATION 11
109#define GSMGNSS_GNGGA_GEOIDAL_SEPARATION_UNIT 12
110#define GSMGNSS_GNGGA_TIME_SINCE_LAST_DGPS 13
111#define GSMGNSS_GNGGA_DGPS_REFERENCE_STATION_ID 14
118#define GSMGNSS_GNGLL_LATITUDE 1
119#define GSMGNSS_GNGLL_LATITUDE_SIDE 2
120#define GSMGNSS_GNGLL_LONGITUDE 3
121#define GSMGNSS_GNGLL_LONGITUDE_SIDE 4
128#define GSMGNSS_ERROR_COMMAND_OR_ELEMENT 0xFF
129#define GSMGNSS_ERROR_START_OR_END_COMMAND 0x8F
130#define GSMGNSS_ERROR_NEXT_ELEMENT 0x4F
131#define GSMGNSS_ERROR_CURRENT_ELEMENT 0x2F
132#define GSMGNSS_NO_ERROR 0x00
139#define GSMGNSS_MODULE_POWER_ON 1
140#define GSMGNSS_MODULE_POWER_OFF 0
147#define GSMGNSS_CMD_AT "AT"
148#define GSMGNSS_CMD_ATI "ATI"
149#define GSMGNSS_CMD_CGMR "AT+CGMR"
151#define GSMGNSS_CMD_CFUN "AT+CFUN"
152#define GSMGNSS_CMD_CREG "AT+CREG"
153#define GSMGNSS_CMD_CGREG "AT+CGREG"
154#define GSMGNSS_CMD_CGDCONT "AT+CGDCONT"
155#define GSMGNSS_CMD_CIMI "AT+CIMI"
156#define GSMGNSS_CMD_CMEE "AT+CMEE"
157#define GSMGNSS_CMD_CGATT "AT+CGATT"
158#define GSMGNSS_CMD_CSQ "AT+CSQ"
159#define GSMGNSS_CMD_COPS "AT+COPS"
160#define GSMGNSS_CMD_CMGS "AT+CMGS"
161#define GSMGNSS_CMD_CMGF "AT+CMGF"
162#define GSMGNSS_CMD_QGNSSC "AT+QGNSSC"
163#define GSMGNSS_CMD_QGNSSRD "AT+QGNSSRD"
170#define DRV_RX_BUFFER_SIZE 256
171#define DRV_TX_BUFFER_SIZE 256
406 char *phone_number,
char *sms_text );
418 char *rsp, uint8_t command,
419 uint8_t element,
char *parser_buf
#define DRV_RX_BUFFER_SIZE
Definition gsmgnss.h:170
#define DRV_TX_BUFFER_SIZE
Definition gsmgnss.h:171
#define GSMGNSS_RETVAL
Definition gsmgnss.h:81
void gsmgnss_send_sms_text(gsmgnss_t *ctx, char *phone_number, char *sms_text)
GSM GNSS send SMS in text mode.
void gsmgnss_set_rts(gsmgnss_t *ctx, uint8_t state)
Sets state of the RTS pin.
void gsmgnss_cfg_setup(gsmgnss_cfg_t *cfg)
Config Object Initialization function.
uint8_t gsmgnss_get_cts(gsmgnss_t *ctx)
CTS Pin Get function.
void gsmgnss_send_cmd(gsmgnss_t *ctx, char *cmd)
Send command function.
int32_t gsmgnss_generic_read(gsmgnss_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
gsmgnss_error_t gsmgnss_generic_parser(char *rsp, uint8_t command, uint8_t element, char *parser_buf)
Generic parser function.
void gsmgnss_send_cmd_parameter_check(gsmgnss_t *ctx, char *at_cmd_buf)
Check the command parameters.
void gsmgnss_module_power(gsmgnss_t *ctx, uint8_t state)
Power ON/OFF the module.
void gsmgnss_set_sim_apn(gsmgnss_t *ctx, char *sim_apn)
Set sim card APN.
void gsmgnss_send_cmd_check(gsmgnss_t *ctx, char *at_cmd_buf)
Check the sent command.
err_t gsmgnss_send_sms_pdu(gsmgnss_t *ctx, char *service_center_number, char *phone_number, char *sms_text)
GSM GNSS send SMS in PDU mode.
GSMGNSS_RETVAL gsmgnss_init(gsmgnss_t *ctx, gsmgnss_cfg_t *cfg)
Initialization function.
void gsmgnss_generic_write(gsmgnss_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void gsmgnss_send_cmd_with_parameter(gsmgnss_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
GSMGNSS_return_value_t
GSM GNSS Click return value data.
Definition gsmgnss.h:238
uint8_t gsmgnss_error_t
Error type.
Definition gsmgnss.h:247
@ GSMGNSS_OK
Definition gsmgnss.h:239
@ GSMGNSS_ERROR
Definition gsmgnss.h:240
Click configuration structure definition.
Definition gsmgnss.h:209
pin_name_t rts
Definition gsmgnss.h:219
pin_name_t det
Definition gsmgnss.h:217
uint32_t baud_rate
Definition gsmgnss.h:225
pin_name_t cts
Definition gsmgnss.h:221
pin_name_t ring
Definition gsmgnss.h:220
bool uart_blocking
Definition gsmgnss.h:226
uart_data_bits_t data_bit
Definition gsmgnss.h:227
pin_name_t tx_pin
Definition gsmgnss.h:213
pin_name_t rx_pin
Definition gsmgnss.h:212
uart_stop_bits_t stop_bit
Definition gsmgnss.h:229
uart_parity_t parity_bit
Definition gsmgnss.h:228
pin_name_t rst
Definition gsmgnss.h:218
Click ctx object definition.
Definition gsmgnss.h:184
digital_out_t rts
Definition gsmgnss.h:188
uart_t uart
Definition gsmgnss.h:198
digital_in_t cts
Definition gsmgnss.h:194
digital_out_t rst
Definition gsmgnss.h:187
digital_in_t ring
Definition gsmgnss.h:193
digital_in_t det
Definition gsmgnss.h:192