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 GSM_CMD_AT "AT"
74#define GSM_CMD_ATI "ATI"
75#define GSM_CMD_CFUN "AT+CFUN"
76#define GSM_CMD_CREG "AT+CREG"
77#define GSM_CMD_CGDCONT "AT+CGDCONT"
78#define GSM_CMD_CSQ "AT+CSQ"
79#define GSM_CMD_COPS "AT+COPS"
80#define GSM_CMD_CMGS "AT+CMGS"
81#define GSM_CMD_CMGF "AT+CMGF"
82#define GSM_CMD_SGACT "AT#SGACT"
83#define GSM_CMD_SD "AT#SD"
84#define GSM_CMD_SH "AT#SH"
85#define GSM_CMD_SSEND "AT#SSEND"
86#define GSM_CMD_SRECV "AT#SRECV"
92#define GSM_RSP_OK "OK"
93#define GSM_RSP_ERROR "ERROR"
100#define GSM_RX_DRV_BUFFER_SIZE 256
101#define GSM_TX_DRV_BUFFER_SIZE 256
119#define GSM_MAP_MIKROBUS( cfg, mikrobus ) \
120 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
121 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
122 cfg.pwr = MIKROBUS( mikrobus, MIKROBUS_AN ); \
123 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
124 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
125 cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
126 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
#define GSM_RX_DRV_BUFFER_SIZE
GSM driver buffer size.
Definition gsm.h:100
#define GSM_TX_DRV_BUFFER_SIZE
Definition gsm.h:101
err_t gsm_init(gsm_t *ctx, gsm_cfg_t *cfg)
GSM initialization function.
uint8_t gsm_get_gp2_pin(gsm_t *ctx)
GSM get gp2 pin function.
void gsm_send_cmd_par_check(gsm_t *ctx, uint8_t *at_cmd_buf)
Check the command parameters.
void gsm_set_rts_pin(gsm_t *ctx, uint8_t state)
GSM set rts pin function.
err_t gsm_send_sms_pdu(gsm_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
GSM send SMS in PDU mode.
void gsm_send_cmd_with_par(gsm_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
Send command function with parameter.
uint8_t gsm_get_cts_pin(gsm_t *ctx)
GSM get cts pin function.
void gsm_set_rst_pin(gsm_t *ctx, uint8_t state)
GSM set rst pin function.
void gsm_cfg_setup(gsm_cfg_t *cfg)
GSM configuration object setup function.
err_t gsm_generic_read(gsm_t *ctx, uint8_t *data_out, uint16_t len)
GSM data reading function.
void gsm_set_sim_apn(gsm_t *ctx, uint8_t *sim_apn)
Set sim card APN.
void gsm_send_cmd_check(gsm_t *ctx, uint8_t *at_cmd_buf)
Check the sent command.
uint8_t gsm_get_pwr_pin(gsm_t *ctx)
GSM get pwr pin function.
void gsm_send_cmd(gsm_t *ctx, uint8_t *cmd)
Send command function.
void gsm_send_sms_text(gsm_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
GSM send SMS in text mode.
err_t gsm_generic_write(gsm_t *ctx, uint8_t *data_in, uint16_t len)
GSM data writing function.
gsm_return_value_t
GSM Click return value data.
Definition gsm.h:186
@ GSM_ERROR_CMD
Definition gsm.h:190
@ GSM_ERROR
Definition gsm.h:188
@ GSM_OK
Definition gsm.h:187
@ GSM_ERROR_TIMEOUT
Definition gsm.h:189
@ GSM_ERROR_UNKNOWN
Definition gsm.h:191
GSM Click configuration object.
Definition gsm.h:160
pin_name_t rts
Definition gsm.h:168
uint32_t baud_rate
Definition gsm.h:173
pin_name_t gp2
Definition gsm.h:169
pin_name_t cts
Definition gsm.h:170
bool uart_blocking
Definition gsm.h:174
uart_data_bits_t data_bit
Definition gsm.h:175
pin_name_t tx_pin
Definition gsm.h:163
pin_name_t pwr
Definition gsm.h:166
pin_name_t rx_pin
Definition gsm.h:162
uart_stop_bits_t stop_bit
Definition gsm.h:177
uart_parity_t parity_bit
Definition gsm.h:176
pin_name_t rst
Definition gsm.h:167
GSM Click context object.
Definition gsm.h:136
digital_in_t pwr
Definition gsm.h:142
digital_out_t rts
Definition gsm.h:139
digital_in_t gp2
Definition gsm.h:143
uart_t uart
Definition gsm.h:147
digital_in_t cts
Definition gsm.h:144
digital_out_t rst
Definition gsm.h:138