g2c3g 2.1.0.0
G2C 3G Click Driver

API for configuring and manipulating G2C 3G Click driver. More...

Topics

 G2C 3G Device Settings
 Settings for registers of G2C 3G Click driver.
 
 G2C 3G MikroBUS Map
 MikroBUS pin mapping of G2C 3G Click driver.
 

Functions

void g2c3g_cfg_setup (g2c3g_cfg_t *cfg)
 G2C 3G configuration object setup function.
 
err_t g2c3g_init (g2c3g_t *ctx, g2c3g_cfg_t *cfg)
 G2C 3G initialization function.
 
err_t g2c3g_generic_write (g2c3g_t *ctx, uint8_t *data_in, uint16_t len)
 G2C 3G data writing function.
 
err_t g2c3g_generic_read (g2c3g_t *ctx, uint8_t *data_out, uint16_t len)
 G2C 3G data reading function.
 
void g2c3g_set_cts_pin (g2c3g_t *ctx, uint8_t state)
 G2C 3G set cts pin function.
 
void g2c3g_set_rst_pin (g2c3g_t *ctx, uint8_t state)
 G2C 3G set rst pin function.
 
uint8_t g2c3g_get_gp0_pin (g2c3g_t *ctx)
 G2C 3G get gp0 pin function.
 
uint8_t g2c3g_get_gp1_pin (g2c3g_t *ctx)
 G2C 3G get gp1 pin function.
 
uint8_t g2c3g_get_rts_pin (g2c3g_t *ctx)
 G2C 3G get rts pin function.
 
void g2c3g_reset_device (g2c3g_t *ctx)
 G2C 3G reset device function.
 
void g2c3g_send_cmd (g2c3g_t *ctx, uint8_t *cmd)
 G2C 3G send command function.
 
void g2c3g_send_cmd_with_par (g2c3g_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
 G2C 3G send command function with parameter.
 
void g2c3g_send_cmd_check (g2c3g_t *ctx, uint8_t *at_cmd_buf)
 G2C 3G check the sent command.
 
void g2c3g_send_cmd_par_check (g2c3g_t *ctx, uint8_t *at_cmd_buf)
 G2C 3G check the command parameters.
 
void g2c3g_set_net_creds (g2c3g_t *ctx, uint8_t *sim_apn, uint8_t *username, uint8_t *password)
 G2C 3G set network credentials.
 
void g2c3g_set_broker_creds (g2c3g_t *ctx, uint8_t *dev_key, uint8_t *password)
 G2C 3G set broker credentials.
 

Detailed Description

API for configuring and manipulating G2C 3G Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ g2c3g_cfg_setup()

void g2c3g_cfg_setup ( g2c3g_cfg_t * cfg)

G2C 3G configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See g2c3g_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ g2c3g_generic_read()

err_t g2c3g_generic_read ( g2c3g_t * ctx,
uint8_t * data_out,
uint16_t len )

G2C 3G data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ g2c3g_generic_write()

err_t g2c3g_generic_write ( g2c3g_t * ctx,
uint8_t * data_in,
uint16_t len )

G2C 3G data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ g2c3g_get_gp0_pin()

uint8_t g2c3g_get_gp0_pin ( g2c3g_t * ctx)

G2C 3G get gp0 pin function.

This function returns the GPIO 0 (cloud connect indication) pin logic state.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ g2c3g_get_gp1_pin()

uint8_t g2c3g_get_gp1_pin ( g2c3g_t * ctx)

G2C 3G get gp1 pin function.

This function returns the GPIO 1 (network connect indication) pin logic state.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ g2c3g_get_rts_pin()

uint8_t g2c3g_get_rts_pin ( g2c3g_t * ctx)

G2C 3G get rts pin function.

This function returns the Request to Send (RTS) pin logic state.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ g2c3g_init()

err_t g2c3g_init ( g2c3g_t * ctx,
g2c3g_cfg_t * cfg )

G2C 3G initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See g2c3g_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ g2c3g_reset_device()

void g2c3g_reset_device ( g2c3g_t * ctx)

G2C 3G reset device function.

This function resets the device by toggling the RST pin.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ g2c3g_send_cmd()

void g2c3g_send_cmd ( g2c3g_t * ctx,
uint8_t * cmd )

G2C 3G send command function.

This function sends a specified command to the click module.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]cmd: Command variable.
Returns
Nothing.
Note
None.

◆ g2c3g_send_cmd_check()

void g2c3g_send_cmd_check ( g2c3g_t * ctx,
uint8_t * at_cmd_buf )

G2C 3G check the sent command.

This function checks the command that is sent.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]at_cmd_buf: Command buffer.
Returns
Nothing.
Note
None.

◆ g2c3g_send_cmd_par_check()

void g2c3g_send_cmd_par_check ( g2c3g_t * ctx,
uint8_t * at_cmd_buf )

G2C 3G check the command parameters.

This function checks the command that is sent.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]at_cmd_buf: Command buffer.
Returns
Nothing.
Note
None.

◆ g2c3g_send_cmd_with_par()

void g2c3g_send_cmd_with_par ( g2c3g_t * ctx,
uint8_t * at_cmd_buf,
uint8_t * param_buf )

G2C 3G send command function with parameter.

This function sends a command with specified parameter to the click module.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]at_cmd_buf: Command buffer.
[in]param_buf: Parameter buffer.
Returns
Nothing.
Note
None.

◆ g2c3g_set_broker_creds()

void g2c3g_set_broker_creds ( g2c3g_t * ctx,
uint8_t * dev_key,
uint8_t * password )

G2C 3G set broker credentials.

This function sets the broker credentials (device key and password).

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]dev_key: Device key.
[in]password: Device password.
Returns
Nothing.
Note
None.

◆ g2c3g_set_cts_pin()

void g2c3g_set_cts_pin ( g2c3g_t * ctx,
uint8_t state )

G2C 3G set cts pin function.

This function sets the Clear to Send (CTS) pin logic state.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ g2c3g_set_net_creds()

void g2c3g_set_net_creds ( g2c3g_t * ctx,
uint8_t * sim_apn,
uint8_t * username,
uint8_t * password )

G2C 3G set network credentials.

This function sets the APN, username, and password for entered sim card.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]sim_apn: SIM card APN.
[in]username: SIM card username.
[in]password: SIM card password.
Returns
Nothing.
Note
None.

◆ g2c3g_set_rst_pin()

void g2c3g_set_rst_pin ( g2c3g_t * ctx,
uint8_t state )

G2C 3G set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See g2c3g_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.