g2c 2.1.0.0
G2C Click Driver

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

Topics

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

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

API for configuring and manipulating G2C 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

◆ g2c_cfg_setup()

void g2c_cfg_setup ( g2c_cfg_t * cfg)

G2C configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ g2c_generic_read()

err_t g2c_generic_read ( g2c_t * ctx,
uint8_t * data_out,
uint16_t len )

G2C data reading function.

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

Parameters
[in]ctx: Click context object. See g2c_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.

◆ g2c_generic_write()

err_t g2c_generic_write ( g2c_t * ctx,
uint8_t * data_in,
uint16_t len )

G2C data writing function.

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

Parameters
[in]ctx: Click context object. See g2c_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.

◆ g2c_get_gp0_pin()

uint8_t g2c_get_gp0_pin ( g2c_t * ctx)

G2C get gp0 pin function.

This function returns the GPIO 0 pin logic state.

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

◆ g2c_get_gp1_pin()

uint8_t g2c_get_gp1_pin ( g2c_t * ctx)

G2C get gp1 pin function.

This function returns the GPIO 1 pin logic state.

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

◆ g2c_get_rts_pin()

uint8_t g2c_get_rts_pin ( g2c_t * ctx)

G2C get rts pin function.

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

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

◆ g2c_init()

err_t g2c_init ( g2c_t * ctx,
g2c_cfg_t * cfg )

G2C initialization function.

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

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

◆ g2c_reset_device()

void g2c_reset_device ( g2c_t * ctx)

G2C reset device function.

This function resets the device by toggling the RST pin.

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

◆ g2c_send_cmd()

void g2c_send_cmd ( g2c_t * ctx,
uint8_t * cmd )

G2C send command function.

This function sends a specified command to the click module.

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

◆ g2c_send_cmd_check()

void g2c_send_cmd_check ( g2c_t * ctx,
uint8_t * at_cmd_buf )

G2C check the sent command.

This function checks the command that is sent.

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

◆ g2c_send_cmd_par_check()

void g2c_send_cmd_par_check ( g2c_t * ctx,
uint8_t * at_cmd_buf )

G2C check the command parameters.

This function checks the command that is sent.

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

◆ g2c_send_cmd_with_par()

void g2c_send_cmd_with_par ( g2c_t * ctx,
uint8_t * at_cmd_buf,
uint8_t * param_buf )

G2C send command function with parameter.

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

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

◆ g2c_set_broker_creds()

void g2c_set_broker_creds ( g2c_t * ctx,
uint8_t * dev_key,
uint8_t * password )

G2C set broker credentials.

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

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

◆ g2c_set_cts_pin()

void g2c_set_cts_pin ( g2c_t * ctx,
uint8_t state )

G2C set cts pin function.

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

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

◆ g2c_set_net_creds()

void g2c_set_net_creds ( g2c_t * ctx,
uint8_t * wifi_ssid,
uint8_t * wifi_pass )

G2C set network credentials.

This function sets the WiFi network credentials.

Parameters
[in]ctx: Click context object. See g2c_t object definition for detailed explanation.
[in]wifi_ssid: WiFi SSID.
[in]wifi_pass: WiFi Password.
Returns
Nothing.
Note
None.

◆ g2c_set_rst_pin()

void g2c_set_rst_pin ( g2c_t * ctx,
uint8_t state )

G2C set rst pin function.

This function sets the RST pin logic state.

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