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 GSM4_CMD_AT "AT"
74#define GSM4_CMD_CFUN "AT+CFUN"
75#define GSM4_CMD_CREG "AT+CREG"
76#define GSM4_CMD_CGDCONT "AT+CGDCONT"
77#define GSM4_CMD_CSQ "AT+CSQ"
78#define GSM4_CMD_COPS "AT+COPS"
79#define GSM4_CMD_CMGS "AT+CMGS"
80#define GSM4_CMD_CMGF "AT+CMGF"
81#define GSM4_CMD_CGACT "AT+CGACT"
82#define GSM4_CMD_UPSDA "AT+UPSDA"
83#define GSM4_CMD_USOCR "AT+USOCR"
84#define GSM4_CMD_USOCO "AT+USOCO"
85#define GSM4_CMD_USOWR "AT+USOWR"
86#define GSM4_CMD_USORD "AT+USORD"
87#define GSM4_CMD_USORF "AT+USORF"
88#define GSM4_CMD_USOCL "AT+USOCL"
94#define GSM4_RSP_OK "OK"
95#define GSM4_RSP_ERROR "ERROR"
102#define GSM4_RX_DRV_BUFFER_SIZE 256
103#define GSM4_TX_DRV_BUFFER_SIZE 256
121#define GSM4_MAP_MIKROBUS( cfg, mikrobus ) \
122 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
123 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
124 cfg.sta = MIKROBUS( mikrobus, MIKROBUS_AN ); \
125 cfg.pwr = MIKROBUS( mikrobus, MIKROBUS_RST ); \
126 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
127 cfg.ring = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
128 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
#define GSM4_RX_DRV_BUFFER_SIZE
GSM 4 driver buffer size.
Definition gsm4.h:102
#define GSM4_TX_DRV_BUFFER_SIZE
Definition gsm4.h:103
uint8_t gsm4_get_cts_pin(gsm4_t *ctx)
GSM 4 get cts pin function.
void gsm4_set_rts_pin(gsm4_t *ctx, uint8_t state)
GSM 4 set rts pin function.
void gsm4_send_sms_text(gsm4_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
GSM 4 send SMS in text mode.
void gsm4_send_cmd(gsm4_t *ctx, uint8_t *cmd)
Send command function.
void gsm4_set_sim_apn(gsm4_t *ctx, uint8_t *sim_apn)
Set sim card APN.
void gsm4_cfg_setup(gsm4_cfg_t *cfg)
GSM 4 configuration object setup function.
uint8_t gsm4_get_sta_pin(gsm4_t *ctx)
GSM 4 get sta pin function.
err_t gsm4_init(gsm4_t *ctx, gsm4_cfg_t *cfg)
GSM 4 initialization function.
void gsm4_send_cmd_par_check(gsm4_t *ctx, uint8_t *at_cmd_buf)
Check the command parameters.
uint8_t gsm4_get_ring_pin(gsm4_t *ctx)
GSM 4 get ring pin function.
void gsm4_set_pwr_pin(gsm4_t *ctx, uint8_t state)
GSM 4 set pwr pin function.
err_t gsm4_generic_write(gsm4_t *ctx, uint8_t *data_in, uint16_t len)
GSM 4 data writing function.
void gsm4_send_cmd_check(gsm4_t *ctx, uint8_t *at_cmd_buf)
Check the sent command.
void gsm4_send_cmd_with_par(gsm4_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
Send command function with parameter.
err_t gsm4_send_sms_pdu(gsm4_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
GSM 4 send SMS in PDU mode.
err_t gsm4_generic_read(gsm4_t *ctx, uint8_t *data_out, uint16_t len)
GSM 4 data reading function.
gsm4_return_value_t
GSM 4 Click return value data.
Definition gsm4.h:188
@ GSM4_OK
Definition gsm4.h:189
@ GSM4_ERROR_UNKNOWN
Definition gsm4.h:193
@ GSM4_ERROR
Definition gsm4.h:190
@ GSM4_ERROR_TIMEOUT
Definition gsm4.h:191
@ GSM4_ERROR_CMD
Definition gsm4.h:192
GSM 4 Click configuration object.
Definition gsm4.h:162
pin_name_t sta
Definition gsm4.h:171
pin_name_t rts
Definition gsm4.h:169
uint32_t baud_rate
Definition gsm4.h:175
pin_name_t cts
Definition gsm4.h:172
pin_name_t ring
Definition gsm4.h:170
bool uart_blocking
Definition gsm4.h:176
uart_data_bits_t data_bit
Definition gsm4.h:177
pin_name_t tx_pin
Definition gsm4.h:165
pin_name_t pwr
Definition gsm4.h:168
pin_name_t rx_pin
Definition gsm4.h:164
uart_stop_bits_t stop_bit
Definition gsm4.h:179
uart_parity_t parity_bit
Definition gsm4.h:178
GSM 4 Click context object.
Definition gsm4.h:138
digital_in_t sta
Definition gsm4.h:144
digital_out_t pwr
Definition gsm4.h:140
digital_out_t rts
Definition gsm4.h:141
uart_t uart
Definition gsm4.h:149
digital_in_t cts
Definition gsm4.h:146
digital_in_t ring
Definition gsm4.h:145