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 GSM2_CMD_AT "AT"
74#define GSM2_CMD_ATI "ATI"
75#define GSM2_CMD_CFUN "AT+CFUN"
76#define GSM2_CMD_CREG "AT+CREG"
77#define GSM2_CMD_CGDCONT "AT+CGDCONT"
78#define GSM2_CMD_CSQ "AT+CSQ"
79#define GSM2_CMD_COPS "AT+COPS"
80#define GSM2_CMD_CMGS "AT+CMGS"
81#define GSM2_CMD_CMGF "AT+CMGF"
82#define GSM2_CMD_CGACT "AT+CGACT"
83#define GSM2_CMD_QIMUX "AT+QIMUX"
84#define GSM2_CMD_QIOPEN "AT+QIOPEN"
85#define GSM2_CMD_QICLOSE "AT+QICLOSE"
86#define GSM2_CMD_QISEND "AT+QISEND"
87#define GSM2_CMD_QIRD "AT+QIRD"
93#define GSM2_RSP_OK "OK"
94#define GSM2_RSP_ERROR "ERROR"
101#define GSM2_RX_DRV_BUFFER_SIZE 256
102#define GSM2_TX_DRV_BUFFER_SIZE 256
120#define GSM2_MAP_MIKROBUS( cfg, mikrobus ) \
121 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
122 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
123 cfg.sta = MIKROBUS( mikrobus, MIKROBUS_AN ); \
124 cfg.pwk = MIKROBUS( mikrobus, MIKROBUS_RST ); \
125 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
126 cfg.ring = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
127 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
#define GSM2_RX_DRV_BUFFER_SIZE
GSM 2 driver buffer size.
Definition gsm2.h:101
#define GSM2_TX_DRV_BUFFER_SIZE
Definition gsm2.h:102
void gsm2_set_pwk_pin(gsm2_t *ctx, uint8_t state)
GSM 2 set pwk pin function.
void gsm2_send_cmd_check(gsm2_t *ctx, uint8_t *at_cmd_buf)
Check the sent command.
void gsm2_send_sms_text(gsm2_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
GSM 2 send SMS in text mode.
void gsm2_send_cmd_par_check(gsm2_t *ctx, uint8_t *at_cmd_buf)
Check the command parameters.
err_t gsm2_send_sms_pdu(gsm2_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
GSM 2 send SMS in PDU mode.
uint8_t gsm2_get_ring_pin(gsm2_t *ctx)
GSM 2 get ring pin function.
err_t gsm2_generic_write(gsm2_t *ctx, uint8_t *data_in, uint16_t len)
GSM 2 data writing function.
void gsm2_cfg_setup(gsm2_cfg_t *cfg)
GSM 2 configuration object setup function.
err_t gsm2_init(gsm2_t *ctx, gsm2_cfg_t *cfg)
GSM 2 initialization function.
uint8_t gsm2_get_cts_pin(gsm2_t *ctx)
GSM 2 get cts pin function.
void gsm2_set_rts_pin(gsm2_t *ctx, uint8_t state)
GSM 2 set rts pin function.
void gsm2_send_cmd_with_par(gsm2_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
Send command function with parameter.
void gsm2_set_sim_apn(gsm2_t *ctx, uint8_t *sim_apn)
Set sim card APN.
uint8_t gsm2_get_sta_pin(gsm2_t *ctx)
GSM 2 get sta pin function.
void gsm2_send_cmd(gsm2_t *ctx, uint8_t *cmd)
Send command function.
err_t gsm2_generic_read(gsm2_t *ctx, uint8_t *data_out, uint16_t len)
GSM 2 data reading function.
gsm2_return_value_t
GSM 2 Click return value data.
Definition gsm2.h:187
@ GSM2_ERROR_UNKNOWN
Definition gsm2.h:192
@ GSM2_OK
Definition gsm2.h:188
@ GSM2_ERROR
Definition gsm2.h:189
@ GSM2_ERROR_CMD
Definition gsm2.h:191
@ GSM2_ERROR_TIMEOUT
Definition gsm2.h:190
GSM 2 Click configuration object.
Definition gsm2.h:161
pin_name_t sta
Definition gsm2.h:167
pin_name_t rts
Definition gsm2.h:169
uint32_t baud_rate
Definition gsm2.h:174
pin_name_t pwk
Definition gsm2.h:168
pin_name_t cts
Definition gsm2.h:171
pin_name_t ring
Definition gsm2.h:170
bool uart_blocking
Definition gsm2.h:175
uart_data_bits_t data_bit
Definition gsm2.h:176
pin_name_t tx_pin
Definition gsm2.h:164
pin_name_t rx_pin
Definition gsm2.h:163
uart_stop_bits_t stop_bit
Definition gsm2.h:178
uart_parity_t parity_bit
Definition gsm2.h:177
GSM 2 Click context object.
Definition gsm2.h:137
digital_in_t sta
Definition gsm2.h:143
digital_out_t rts
Definition gsm2.h:140
uart_t uart
Definition gsm2.h:148
digital_in_t cts
Definition gsm2.h:145
digital_out_t pwk
Definition gsm2.h:139
digital_in_t ring
Definition gsm2.h:144