ecg2 2.0.0.0
ECG 2 Click Driver

API for configuring and manipulating ECG 2 Click driver. More...

Topics

 ECG 2 Registers List
 List of registers of ECG 2 Click driver.
 
 ECG 2 Registers Settings
 Settings for registers of ECG 2 Click driver.
 
 ECG 2 MikroBUS Map
 MikroBUS pin mapping of ECG 2 Click driver.
 

Functions

void ecg2_cfg_setup (ecg2_cfg_t *cfg)
 ECG 2 configuration object setup function.
 
err_t ecg2_init (ecg2_t *ctx, ecg2_cfg_t *cfg)
 ECG 2 initialization function.
 
err_t ecg2_default_cfg (ecg2_t *ctx)
 ECG 2 default configuration function.
 
err_t ecg2_generic_write (ecg2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ECG 2 data writing function.
 
err_t ecg2_generic_read (ecg2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ECG 2 data reading function.
 
err_t ecg2_read_an_pin_value (ecg2_t *ctx, uint16_t *data_out)
 ECG 2 read AN pin value function.
 
err_t ecg2_write_register (ecg2_t *ctx, uint8_t reg, uint8_t data_in)
 ECG 2 register data write function.
 
err_t ecg2_read_register (ecg2_t *ctx, uint8_t reg, uint8_t *data_out)
 ECG 2 register data reading function.
 
err_t ecg2_multi_write (ecg2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ECG 2 data multi writing function.
 
err_t ecg2_multi_read (ecg2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ECG 2 data multi reading function.
 
err_t ecg2_send_command (ecg2_t *ctx, uint8_t command)
 ECG 2 send command function.
 
void ecg2_hw_reset (ecg2_t *ctx)
 ECG 2 hardware reset function.
 
uint8_t ecg2_get_device_id (ecg2_t *ctx)
 ECG 2 get device id function.
 
err_t ecg2_configure_channel (ecg2_t *ctx, uint8_t channel, uint8_t enable, uint8_t pga_gain, int8_t channel_input)
 ECG 2 configure channel function.
 
void ecg2_right_leg_positive_drive_set (ecg2_t *ctx, uint8_t data_in)
 ECG 2 right leg positive drive settings function.
 
void ecg2_right_leg_negative_drive_set (ecg2_t *ctx, uint8_t data_in)
 ECG 2 right leg negative drive settings function.
 
void ecg2_lead_off_positive_channel_select (ecg2_t *ctx, uint8_t data_in)
 ECG 2 lead off positive drive settings function.
 
void ecg2_lead_off_negative_channel_select (ecg2_t *ctx, uint8_t data_in)
 ECG 2 lead off negative drive settings function.
 
void ecg2_lead_off_current_direction_select (ecg2_t *ctx, uint8_t data_in)
 ECG 2 lead off current direction drive settings function.
 
err_t ecg2_pace_detect_even_channels_select (ecg2_t *ctx, uint8_t select)
 ECG 2 pace detect even chanels drive settings function.
 
err_t ecg2_pace_detect_odd_channels_select (ecg2_t *ctx, uint8_t select)
 ECG 2 pace detect odd chanels drive settings function.
 
void ecg2_wilson_center_terminal_configure (ecg2_t *ctx, uint16_t set)
 ECG 2 right leg positive drive settings function.
 
uint8_t ecg2_data_ready (ecg2_t *ctx)
 ECG 2 is data ready function.
 
err_t ecg2_read_data (ecg2_t *ctx, uint8_t *data_out, uint8_t len)
 ECG 2 read ADC data function.
 
err_t ecg2_read_channel_data (ecg2_t *ctx, uint8_t channel, uint16_t *data_out)
 ECG 2 read data channel function.
 

Detailed Description

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

◆ ecg2_cfg_setup()

void ecg2_cfg_setup ( ecg2_cfg_t * cfg)

ECG 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ecg2_configure_channel()

err_t ecg2_configure_channel ( ecg2_t * ctx,
uint8_t channel,
uint8_t enable,
uint8_t pga_gain,
int8_t channel_input )

ECG 2 configure channel function.

This function configure selected channel by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]channel: Selected channel.
[in]enable: State of the selected channel.
[in]pga_gain: Settings for channel pga gain.
[in]channel_input: Settings for channel input mode.
Returns
Nothing.

◆ ecg2_data_ready()

uint8_t ecg2_data_ready ( ecg2_t * ctx)

ECG 2 is data ready function.

This function gets state of DRD pin.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
Returns
State of DRD pin.

◆ ecg2_default_cfg()

err_t ecg2_default_cfg ( ecg2_t * ctx)

ECG 2 default configuration function.

This function executes a default configuration of ECG 2 click board.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ ecg2_generic_read()

err_t ecg2_generic_read ( ecg2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

ECG 2 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_generic_write()

err_t ecg2_generic_write ( ecg2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

ECG 2 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_get_device_id()

uint8_t ecg2_get_device_id ( ecg2_t * ctx)

ECG 2 get device id function.

This function reads device id by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
Returns
Device ID

◆ ecg2_hw_reset()

void ecg2_hw_reset ( ecg2_t * ctx)

ECG 2 hardware reset function.

This function is used to perform a hardware reset.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
Returns
Nothing.

◆ ecg2_init()

err_t ecg2_init ( ecg2_t * ctx,
ecg2_cfg_t * cfg )

ECG 2 initialization function.

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

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

◆ ecg2_lead_off_current_direction_select()

void ecg2_lead_off_current_direction_select ( ecg2_t * ctx,
uint8_t data_in )

ECG 2 lead off current direction drive settings function.

This function configuring lead off current direction drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_lead_off_negative_channel_select()

void ecg2_lead_off_negative_channel_select ( ecg2_t * ctx,
uint8_t data_in )

ECG 2 lead off negative drive settings function.

This function configuring lead off negative drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_lead_off_positive_channel_select()

void ecg2_lead_off_positive_channel_select ( ecg2_t * ctx,
uint8_t data_in )

ECG 2 lead off positive drive settings function.

This function configuring lead off positive drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_multi_read()

err_t ecg2_multi_read ( ecg2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

ECG 2 data multi reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_multi_write()

err_t ecg2_multi_write ( ecg2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

ECG 2 data multi writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_pace_detect_even_channels_select()

err_t ecg2_pace_detect_even_channels_select ( ecg2_t * ctx,
uint8_t select )

ECG 2 pace detect even chanels drive settings function.

This function configuring pace detect even chanels drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.

◆ ecg2_pace_detect_odd_channels_select()

err_t ecg2_pace_detect_odd_channels_select ( ecg2_t * ctx,
uint8_t select )

ECG 2 pace detect odd chanels drive settings function.

This function configuring pace detect odd chanels drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.

◆ ecg2_read_an_pin_value()

err_t ecg2_read_an_pin_value ( ecg2_t * ctx,
uint16_t * data_out )

ECG 2 read AN pin value function.

This function reads results of AD conversion of the AN pin.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_read_channel_data()

err_t ecg2_read_channel_data ( ecg2_t * ctx,
uint8_t channel,
uint16_t * data_out )

ECG 2 read data channel function.

This function reads ADC data of selected channel by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]channel: Selected channel .
[out]data_out: Read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_read_data()

err_t ecg2_read_data ( ecg2_t * ctx,
uint8_t * data_out,
uint8_t len )

ECG 2 read ADC data function.

This function reads raw ADC data by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[out]data_out: Read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_read_register()

err_t ecg2_read_register ( ecg2_t * ctx,
uint8_t reg,
uint8_t * data_out )

ECG 2 register data reading function.

This function reads a data bytes from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_right_leg_negative_drive_set()

void ecg2_right_leg_negative_drive_set ( ecg2_t * ctx,
uint8_t data_in )

ECG 2 right leg negative drive settings function.

This function configuring right leg negative drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_right_leg_positive_drive_set()

void ecg2_right_leg_positive_drive_set ( ecg2_t * ctx,
uint8_t data_in )

ECG 2 right leg positive drive settings function.

This function configuring right leg positive drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_send_command()

err_t ecg2_send_command ( ecg2_t * ctx,
uint8_t command )

ECG 2 send command function.

This function sends a command by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]command: Command to be sent.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ecg2_wilson_center_terminal_configure()

void ecg2_wilson_center_terminal_configure ( ecg2_t * ctx,
uint16_t set )

ECG 2 right leg positive drive settings function.

This function configuring right leg positive drive by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
Nothing.

◆ ecg2_write_register()

err_t ecg2_write_register ( ecg2_t * ctx,
uint8_t reg,
uint8_t data_in )

ECG 2 register data write function.

This function writes a data bytes to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See ecg2_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.