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 G2C_CMD_AT "AT"
74#define G2C_CMD_GMR "AT+GMR"
75#define G2C_CMD_ATE1 "ATE1"
76#define G2C_CMD_ATE0 "ATE0"
77#define G2C_CMD_RST "AT+RST"
78#define G2C_CMD_CRST "AT+CRST"
79#define G2C_CMD_CEN "AT+CEN"
80#define G2C_CMD_GPEN "AT+GPEN"
81#define G2C_CMD_W "AT+W"
82#define G2C_CMD_R "AT+R"
83#define G2C_CMD_NWP "AT+NWP"
84#define G2C_CMD_NWCR "AT+NWCR"
85#define G2C_CMD_NWC "AT+NWC"
86#define G2C_CMD_BRCR "AT+BRCR"
87#define G2C_CMD_BRC "AT+BRC"
88#define G2C_CMD_ASTA "AT+ASTA"
89#define G2C_CMD_DSET "AT+DSET"
90#define G2C_CMD_PUB "AT+PUB"
96#define G2C_RSP_OK "OK"
97#define G2C_RSP_ERROR "ERROR"
98#define G2C_RSP_ERR "+ERR"
99#define G2C_RSP_ACT "+ACT"
106#define G2C_TX_DRV_BUFFER_SIZE 300
107#define G2C_RX_DRV_BUFFER_SIZE 300
125#define G2C_MAP_MIKROBUS( cfg, mikrobus ) \
126 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
127 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
128 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
129 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
130 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
131 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
132 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT );
g2c_return_value_t
G2C Click return value data.
Definition g2c.h:192
@ G2C_OK
Definition g2c.h:193
@ G2C_ERROR_CMD
Definition g2c.h:196
@ G2C_ERROR_UNKNOWN
Definition g2c.h:197
@ G2C_ERROR
Definition g2c.h:194
@ G2C_ERROR_TIMEOUT
Definition g2c.h:195
#define G2C_TX_DRV_BUFFER_SIZE
G2C driver buffer size.
Definition g2c.h:106
#define G2C_RX_DRV_BUFFER_SIZE
Definition g2c.h:107
void g2c_send_cmd(g2c_t *ctx, uint8_t *cmd)
G2C send command function.
void g2c_send_cmd_with_par(g2c_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
G2C send command function with parameter.
uint8_t g2c_get_rts_pin(g2c_t *ctx)
G2C get rts pin function.
void g2c_set_cts_pin(g2c_t *ctx, uint8_t state)
G2C set cts pin function.
uint8_t g2c_get_gp0_pin(g2c_t *ctx)
G2C get gp0 pin function.
void g2c_set_broker_creds(g2c_t *ctx, uint8_t *dev_key, uint8_t *password)
G2C set broker credentials.
uint8_t g2c_get_gp1_pin(g2c_t *ctx)
G2C get gp1 pin function.
void g2c_set_rst_pin(g2c_t *ctx, uint8_t state)
G2C set rst pin function.
err_t g2c_generic_read(g2c_t *ctx, uint8_t *data_out, uint16_t len)
G2C data reading function.
void g2c_send_cmd_par_check(g2c_t *ctx, uint8_t *at_cmd_buf)
G2C check the command parameters.
err_t g2c_init(g2c_t *ctx, g2c_cfg_t *cfg)
G2C initialization function.
void g2c_send_cmd_check(g2c_t *ctx, uint8_t *at_cmd_buf)
G2C check the sent command.
err_t g2c_generic_write(g2c_t *ctx, uint8_t *data_in, uint16_t len)
G2C data writing function.
void g2c_reset_device(g2c_t *ctx)
G2C reset device function.
void g2c_cfg_setup(g2c_cfg_t *cfg)
G2C configuration object setup function.
void g2c_set_net_creds(g2c_t *ctx, uint8_t *wifi_ssid, uint8_t *wifi_pass)
G2C set network credentials.
G2C Click configuration object.
Definition g2c.h:166
pin_name_t rts
Definition g2c.h:176
uint32_t baud_rate
Definition g2c.h:179
pin_name_t gp0
Definition g2c.h:172
pin_name_t cts
Definition g2c.h:174
bool uart_blocking
Definition g2c.h:180
uart_data_bits_t data_bit
Definition g2c.h:181
pin_name_t tx_pin
Definition g2c.h:169
pin_name_t rx_pin
Definition g2c.h:168
uart_stop_bits_t stop_bit
Definition g2c.h:183
pin_name_t gp1
Definition g2c.h:175
uart_parity_t parity_bit
Definition g2c.h:182
pin_name_t rst
Definition g2c.h:173
G2C Click context object.
Definition g2c.h:142
digital_in_t gp1
Definition g2c.h:149
uart_t uart
Definition g2c.h:153
digital_in_t gp0
Definition g2c.h:148
digital_in_t rts
Definition g2c.h:150
digital_out_t rst
Definition g2c.h:144
digital_out_t cts
Definition g2c.h:145