g2c3g  2.0.0.0
Main Page

G2C 3G click

Go to Cloud (G2C) 3G click is a gateway Click boardâ„¢ which provides a simple and reliable connection to the Click Cloud platform

click Product page


Click library

  • Author : Katarina Perendic
  • Date : mar 2020.
  • Type : UART type

Software Support

We provide a library for the G2c3G Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for G2c3G Click driver.

Standard key functions :

  • Config Object Initialization function.

    void g2c3g_cfg_setup ( g2c3g_cfg_t *cfg );

  • Initialization function.

    G2C3G_RETVAL g2c3g_init ( g2c3g_t *ctx, g2c3g_cfg_t *cfg );

Example key functions :

Examples Description

This example reads and processes data from G2C 3G clicks.

The demo application is composed of two sections :

Application Init

Initializes driver and power module.

void application_init ( void )
{
log_cfg_t log_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 57600;
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
g2c3g_cfg_setup( &cfg );
G2C3G_MAP_MIKROBUS( cfg, MIKROBUS_1 );
g2c3g_init( &g2c3g, &cfg );
//g2c3g_module_reset( &g2c3g );
while ( ( g2c3g_led_net( &g2c3g ) != 0 ) || ( g2c3g_led_conn( &g2c3g ) != 0 ) );
while ( g2c3g_led_net( &g2c3g ) != 1 );
while ( g2c3g_led_conn( &g2c3g ) != 1 );
Delay_ms( 2000 );
}

Application Task

Reads the received data and parses it.

void application_task ( void )
{
actuator_demo( current_parser_buf );
if ( send_data_cnt == 5 )
{
g2c3g_send_data_ref( &g2c3g, SENSOR_REF, &data_buf[ 0 ] );
send_data_cnt = 0;
}
send_data_cnt++;
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.G2c3G

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


G2C3G_MAP_MIKROBUS
#define G2C3G_MAP_MIKROBUS(cfg, mikrobus)
Definition: g2c3g.h:52
g2c3g_cfg_t
Click configuration structure definition.
Definition: g2c3g.h:134
G2C3G_AT_PUB
#define G2C3G_AT_PUB
Definition: main.c:44
g2c3g_init
G2C3G_RETVAL g2c3g_init(g2c3g_t *ctx, g2c3g_cfg_t *cfg)
Initialization function.
g2c3g_led_net
uint8_t g2c3g_led_net(g2c3g_t *ctx)
Led network.
G2C3G_AT_GMR
#define G2C3G_AT_GMR
Definition: main.c:40
SENSOR_REF
#define SENSOR_REF
Definition: main.c:50
g2c3g_cfg_setup
void g2c3g_cfg_setup(g2c3g_cfg_t *cfg)
Config Object Initialization function.
DEVICE_PASSWORD
#define DEVICE_PASSWORD
Definition: main.c:59
g2c3g_send_data_ref
void g2c3g_send_data_ref(g2c3g_t *ctx, char *reference_buf, char *data_buf)
Send data reference.
g2c3g_send_broker_cfg
void g2c3g_send_broker_cfg(g2c3g_t *ctx, char *brc_key, char *brc_password)
Broker configuration.
application_task
void application_task(void)
Definition: main.c:197
OPERATOR_APN
#define OPERATOR_APN
Definition: main.c:53
g2c3g_send_command
void g2c3g_send_command(g2c3g_t *ctx, char *command)
Function for send command.
DEVICE_KEY
#define DEVICE_KEY
Definition: main.c:58
g2c3g_process
void g2c3g_process(void)
Definition: main.c:65
g2c3g_led_conn
uint8_t g2c3g_led_conn(g2c3g_t *ctx)
Led connection.
G2C3G_AT_NWC
#define G2C3G_AT_NWC
Definition: main.c:42
application_init
void application_init(void)
Definition: main.c:144
G2C3G_AT_BRC
#define G2C3G_AT_BRC
Definition: main.c:43
OPERATOR_USERNAME
#define OPERATOR_USERNAME
Definition: main.c:54
G2C3G_AT_CEN
#define G2C3G_AT_CEN
Definition: main.c:41
G2C3G_AT
#define G2C3G_AT
Definition: main.c:38
OPERATOR_PASSWORD
#define OPERATOR_PASSWORD
Definition: main.c:55
g2c3g_send_operator_cfg
void g2c3g_send_operator_cfg(g2c3g_t *ctx, char *op_apn, char *op_username, char *op_password)
Operater configuration.