g2c 2.1.0.0
g2c.h File Reference

This file contains API for G2C Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  g2c_t
 G2C Click context object. More...
 
struct  g2c_cfg_t
 G2C Click configuration object. More...
 

Macros

#define G2C_CMD_AT   "AT"
 G2C control commands.
 
#define G2C_CMD_GMR   "AT+GMR"
 
#define G2C_CMD_ATE1   "ATE1"
 
#define G2C_CMD_ATE0   "ATE0"
 
#define G2C_CMD_RST   "AT+RST"
 
#define G2C_CMD_CRST   "AT+CRST"
 
#define G2C_CMD_CEN   "AT+CEN"
 
#define G2C_CMD_GPEN   "AT+GPEN"
 
#define G2C_CMD_W   "AT+W"
 
#define G2C_CMD_R   "AT+R"
 
#define G2C_CMD_NWP   "AT+NWP"
 
#define G2C_CMD_NWCR   "AT+NWCR"
 
#define G2C_CMD_NWC   "AT+NWC"
 
#define G2C_CMD_BRCR   "AT+BRCR"
 
#define G2C_CMD_BRC   "AT+BRC"
 
#define G2C_CMD_ASTA   "AT+ASTA"
 
#define G2C_CMD_DSET   "AT+DSET"
 
#define G2C_CMD_PUB   "AT+PUB"
 
#define G2C_RSP_OK   "OK"
 G2C device response for AT commands.
 
#define G2C_RSP_ERROR   "ERROR"
 
#define G2C_RSP_ERR   "+ERR"
 
#define G2C_RSP_ACT   "+ACT"
 
#define G2C_TX_DRV_BUFFER_SIZE   300
 G2C driver buffer size.
 
#define G2C_RX_DRV_BUFFER_SIZE   300
 
#define G2C_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  g2c_return_value_t {
  G2C_OK = 0 , G2C_ERROR = -1 , G2C_ERROR_TIMEOUT = -2 , G2C_ERROR_CMD = -3 ,
  G2C_ERROR_UNKNOWN = -4
}
 G2C Click return value data. More...
 

Functions

void g2c_cfg_setup (g2c_cfg_t *cfg)
 G2C configuration object setup function.
 
err_t g2c_init (g2c_t *ctx, g2c_cfg_t *cfg)
 G2C initialization function.
 
err_t g2c_generic_write (g2c_t *ctx, uint8_t *data_in, uint16_t len)
 G2C data writing function.
 
err_t g2c_generic_read (g2c_t *ctx, uint8_t *data_out, uint16_t len)
 G2C data reading function.
 
void g2c_set_cts_pin (g2c_t *ctx, uint8_t state)
 G2C set cts pin function.
 
void g2c_set_rst_pin (g2c_t *ctx, uint8_t state)
 G2C set rst pin function.
 
uint8_t g2c_get_gp0_pin (g2c_t *ctx)
 G2C get gp0 pin function.
 
uint8_t g2c_get_gp1_pin (g2c_t *ctx)
 G2C get gp1 pin function.
 
uint8_t g2c_get_rts_pin (g2c_t *ctx)
 G2C get rts pin function.
 
void g2c_reset_device (g2c_t *ctx)
 G2C reset device function.
 
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.
 
void g2c_send_cmd_check (g2c_t *ctx, uint8_t *at_cmd_buf)
 G2C check the sent command.
 
void g2c_send_cmd_par_check (g2c_t *ctx, uint8_t *at_cmd_buf)
 G2C check the command parameters.
 
void g2c_set_net_creds (g2c_t *ctx, uint8_t *wifi_ssid, uint8_t *wifi_pass)
 G2C set network credentials.
 
void g2c_set_broker_creds (g2c_t *ctx, uint8_t *dev_key, uint8_t *password)
 G2C set broker credentials.
 

Detailed Description

This file contains API for G2C Click Driver.

Enumeration Type Documentation

◆ g2c_return_value_t

G2C Click return value data.

Predefined enum values for driver return values.

Enumerator
G2C_OK 
G2C_ERROR 
G2C_ERROR_TIMEOUT 
G2C_ERROR_CMD 
G2C_ERROR_UNKNOWN