39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define GSMGNSS2_CMD_AT "AT"
74#define GSMGNSS2_CMD_ATI "ATI"
75#define GSMGNSS2_CMD_CGMR "AT+CGMR"
76#define GSMGNSS2_CMD_CFUN "AT+CFUN"
77#define GSMGNSS2_CMD_CREG "AT+CREG"
78#define GSMGNSS2_CMD_CGREG "AT+CGREG"
79#define GSMGNSS2_CMD_CGDCONT "AT+CGDCONT"
80#define GSMGNSS2_CMD_CIMI "AT+CIMI"
81#define GSMGNSS2_CMD_CMEE "AT+CMEE"
82#define GSMGNSS2_CMD_CGATT "AT+CGATT"
83#define GSMGNSS2_CMD_CSQ "AT+CSQ"
84#define GSMGNSS2_CMD_COPS "AT+COPS"
85#define GSMGNSS2_CMD_CMGS "AT+CMGS"
86#define GSMGNSS2_CMD_CMGF "AT+CMGF"
87#define GSMGNSS2_CMD_CGNSPWR "AT+CGNSPWR"
88#define GSMGNSS2_CMD_CGNSTST "AT+CGNSTST"
94#define GSMGNSS2_RSP_START "$"
95#define GSMGNSS2_RSP_DELIMITER ","
96#define GSMGNSS2_RSP_GNGGA "$GNGGA"
102#define GSMGNSS2_GNGGA_ELEMENT_SIZE 15
103#define GSMGNSS2_GNGGA_TIME 1
104#define GSMGNSS2_GNGGA_LATITUDE 2
105#define GSMGNSS2_GNGGA_LATITUDE_SIDE 3
106#define GSMGNSS2_GNGGA_LONGITUDE 4
107#define GSMGNSS2_GNGGA_LONGITUDE_SIDE 5
108#define GSMGNSS2_GNGGA_QUALITY_INDICATOR 6
109#define GSMGNSS2_GNGGA_NUMBER_OF_SATELLITES 7
110#define GSMGNSS2_GNGGA_H_DILUTION_OF_POS 8
111#define GSMGNSS2_GNGGA_ALTITUDE 9
112#define GSMGNSS2_GNGGA_ALTITUDE_UNIT 10
113#define GSMGNSS2_GNGGA_GEOIDAL_SEPARATION 11
114#define GSMGNSS2_GNGGA_GEOIDAL_SEPARATION_UNIT 12
115#define GSMGNSS2_GNGGA_TIME_SINCE_LAST_DGPS 13
116#define GSMGNSS2_GNGGA_DGPS_REFERENCE_STATION_ID 14
122#define GSMGNSS2_MODULE_POWER_ON 1
123#define GSMGNSS2_MODULE_POWER_OFF 0
130#define DRV_BUFFER_SIZE_RX 256
131#define DRV_BUFFER_SIZE_TX 256
149#define GSMGNSS2_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
151 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
152 cfg.det = MIKROBUS( mikrobus, MIKROBUS_AN ); \
153 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
154 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
155 cfg.ring = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
156 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
367 char *phone_number,
char *sms_text );
#define DRV_BUFFER_SIZE_TX
Definition gsmgnss2.h:131
#define DRV_BUFFER_SIZE_RX
GSM/GNSS 2 driver buffer size.
Definition gsmgnss2.h:130
void gsmgnss2_send_cmd(gsmgnss2_t *ctx, char *cmd)
Send command function.
void gsmgnss2_send_cmd_parameter_check(gsmgnss2_t *ctx, char *at_cmd_buf)
Check the command parameters.
void gsmgnss2_set_sim_apn(gsmgnss2_t *ctx, char *sim_apn)
Set sim card APN.
void gsmgnss2_module_power(gsmgnss2_t *ctx, uint8_t state)
Power ON/OFF the module.
void gsmgnss2_send_cmd_with_parameter(gsmgnss2_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
err_t gsmgnss2_parse_gngga(char *rsp_buf, uint8_t gngga_element, char *element_data)
GSM GNSS 2 parse GNGGA function.
void gsmgnss2_send_cmd_check(gsmgnss2_t *ctx, char *at_cmd_buf)
Check the sent command.
void gsmgnss2_cfg_setup(gsmgnss2_cfg_t *cfg)
GSM/GNSS 2 configuration object setup function.
err_t gsmgnss2_generic_write(gsmgnss2_t *ctx, char *data_buf, uint16_t len)
GSM/GNSS 2 data writing function.
err_t gsmgnss2_send_sms_pdu(gsmgnss2_t *ctx, char *service_center_number, char *phone_number, char *sms_text)
GSM GNSS 2 send SMS in PDU mode.
void gsmgnss2_send_sms_text(gsmgnss2_t *ctx, char *phone_number, char *sms_text)
GSM GNSS 2 send SMS in text mode.
err_t gsmgnss2_init(gsmgnss2_t *ctx, gsmgnss2_cfg_t *cfg)
GSM/GNSS 2 initialization function.
err_t gsmgnss2_generic_read(gsmgnss2_t *ctx, char *data_buf, uint16_t max_len)
GSM/GNSS 2 data reading function.
gsmgnss2_return_value_t
GSM/GNSS 2 Click return value data.
Definition gsmgnss2.h:219
@ GSMGNSS2_OK
Definition gsmgnss2.h:220
@ GSMGNSS2_ERROR
Definition gsmgnss2.h:221
GSM/GNSS 2 Click configuration object.
Definition gsmgnss2.h:192
pin_name_t rts
Definition gsmgnss2.h:201
pin_name_t det
Definition gsmgnss2.h:199
uint32_t baud_rate
Definition gsmgnss2.h:206
pin_name_t cts
Definition gsmgnss2.h:203
pin_name_t ring
Definition gsmgnss2.h:202
bool uart_blocking
Definition gsmgnss2.h:207
uart_data_bits_t data_bit
Definition gsmgnss2.h:208
pin_name_t tx_pin
Definition gsmgnss2.h:195
pin_name_t rx_pin
Definition gsmgnss2.h:194
uart_stop_bits_t stop_bit
Definition gsmgnss2.h:210
uart_parity_t parity_bit
Definition gsmgnss2.h:209
pin_name_t rst
Definition gsmgnss2.h:200
GSM/GNSS 2 Click context object.
Definition gsmgnss2.h:166
digital_out_t rts
Definition gsmgnss2.h:170
uart_t uart
Definition gsmgnss2.h:179
digital_in_t cts
Definition gsmgnss2.h:176
digital_out_t rst
Definition gsmgnss2.h:169
digital_in_t ring
Definition gsmgnss2.h:175
digital_in_t det
Definition gsmgnss2.h:174