c3gsara 2.0.0.0
3G SARA Click Driver

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

Topics

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

Functions

void c3gsara_cfg_setup (c3gsara_cfg_t *cfg)
 3G SARA configuration object setup function.
 
err_t c3gsara_init (c3gsara_t *ctx, c3gsara_cfg_t *cfg)
 3G SARA initialization function.
 
err_t c3gsara_generic_write (c3gsara_t *ctx, uint8_t *data_in, uint16_t len)
 3G SARA data writing function.
 
err_t c3gsara_generic_read (c3gsara_t *ctx, uint8_t *data_out, uint16_t len)
 3G SARA data reading function.
 
void c3gsara_set_power_state (c3gsara_t *ctx, uint8_t state)
 3G SARA set power state function.
 
void c3gsara_set_rts_pin (c3gsara_t *ctx, uint8_t state)
 3G SARA set rts pin function.
 
void c3gsara_set_pwk_pin (c3gsara_t *ctx, uint8_t state)
 3G SARA set pwk pin function.
 
uint8_t c3gsara_get_cts_pin (c3gsara_t *ctx)
 3G SARA get cts pin function.
 
uint8_t c3gsara_get_sta_pin (c3gsara_t *ctx)
 3G SARA get sta pin function.
 
uint8_t c3gsara_get_ring_pin (c3gsara_t *ctx)
 3G SARA get ring pin function.
 
void c3gsara_send_cmd (c3gsara_t *ctx, uint8_t *cmd)
 Send command function.
 
void c3gsara_send_cmd_with_par (c3gsara_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
 Send command function with parameter.
 
void c3gsara_send_cmd_check (c3gsara_t *ctx, uint8_t *at_cmd_buf)
 Check the sent command.
 
void c3gsara_send_cmd_par_check (c3gsara_t *ctx, uint8_t *at_cmd_buf)
 Check the command parameters.
 
void c3gsara_set_sim_apn (c3gsara_t *ctx, uint8_t *sim_apn)
 Set sim card APN.
 
void c3gsara_send_sms_text (c3gsara_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
 3G SARA send SMS in text mode.
 
err_t c3gsara_send_sms_pdu (c3gsara_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
 3G SARA send SMS in PDU mode.
 

Detailed Description

API for configuring and manipulating 3G SARA 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

◆ c3gsara_cfg_setup()

void c3gsara_cfg_setup ( c3gsara_cfg_t * cfg)

3G SARA configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ c3gsara_generic_read()

err_t c3gsara_generic_read ( c3gsara_t * ctx,
uint8_t * data_out,
uint16_t len )

3G SARA data reading function.

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

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

◆ c3gsara_generic_write()

err_t c3gsara_generic_write ( c3gsara_t * ctx,
uint8_t * data_in,
uint16_t len )

3G SARA data writing function.

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

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

◆ c3gsara_get_cts_pin()

uint8_t c3gsara_get_cts_pin ( c3gsara_t * ctx)

3G SARA get cts pin function.

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

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

◆ c3gsara_get_ring_pin()

uint8_t c3gsara_get_ring_pin ( c3gsara_t * ctx)

3G SARA get ring pin function.

This function returns the ring indication (RING) pin logic state.

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

◆ c3gsara_get_sta_pin()

uint8_t c3gsara_get_sta_pin ( c3gsara_t * ctx)

3G SARA get sta pin function.

This function returns the status (STA) pin logic state.

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

◆ c3gsara_init()

err_t c3gsara_init ( c3gsara_t * ctx,
c3gsara_cfg_t * cfg )

3G SARA initialization function.

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

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

◆ c3gsara_send_cmd()

void c3gsara_send_cmd ( c3gsara_t * ctx,
uint8_t * cmd )

Send command function.

This function sends a specified command to the click module.

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

◆ c3gsara_send_cmd_check()

void c3gsara_send_cmd_check ( c3gsara_t * ctx,
uint8_t * at_cmd_buf )

Check the sent command.

This function checks the command that is sent.

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

◆ c3gsara_send_cmd_par_check()

void c3gsara_send_cmd_par_check ( c3gsara_t * ctx,
uint8_t * at_cmd_buf )

Check the command parameters.

This function checks the command that is sent.

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

◆ c3gsara_send_cmd_with_par()

void c3gsara_send_cmd_with_par ( c3gsara_t * ctx,
uint8_t * at_cmd_buf,
uint8_t * param_buf )

Send command function with parameter.

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

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

◆ c3gsara_send_sms_pdu()

err_t c3gsara_send_sms_pdu ( c3gsara_t * ctx,
uint8_t * service_center_number,
uint8_t * phone_number,
uint8_t * sms_text )

3G SARA send SMS in PDU mode.

This function sends text message to a phone number in PDU mode.

Parameters
[in]ctx: Click context object. See c3gsara_t object definition for detailed explanation.
[in]service_center_number: SMSC of the SIM card.
[in]phone_number: Phone number to message.
[in]sms_text: Message to be sent.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c3gsara_send_sms_text()

void c3gsara_send_sms_text ( c3gsara_t * ctx,
uint8_t * phone_number,
uint8_t * sms_text )

3G SARA send SMS in text mode.

This function sends text message to a phone number.

Parameters
[in]ctx: Click context object. See c3gsara_t object definition for detailed explanation.
[in]phone_number: Phone number to message.
[in]sms_text: Message to be sent.
Returns
Nothing.
Note
None.

◆ c3gsara_set_power_state()

void c3gsara_set_power_state ( c3gsara_t * ctx,
uint8_t state )

3G SARA set power state function.

This function sets a desired power state by toggling PWR pin with a specific time for low state.

Parameters
[in]ctx: Click context object. See c3gsara_t object definition for detailed explanation.
[in]state:
  • 0 - Power OFF,
  • 1 - Power ON.
Returns
None.
Note
None.

◆ c3gsara_set_pwk_pin()

void c3gsara_set_pwk_pin ( c3gsara_t * ctx,
uint8_t state )

3G SARA set pwk pin function.

This function sets the PWRKEY pin logic state.

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

◆ c3gsara_set_rts_pin()

void c3gsara_set_rts_pin ( c3gsara_t * ctx,
uint8_t state )

3G SARA set rts pin function.

This function sets the Ready to Send (RTS) pin logic state.

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

◆ c3gsara_set_sim_apn()

void c3gsara_set_sim_apn ( c3gsara_t * ctx,
uint8_t * sim_apn )

Set sim card APN.

This function sets APN for sim card.

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