noise  2.0.0.0
Functions
Public function

Functions

void noise_cfg_setup (noise_cfg_t *cfg)
 Config Object Initialization function. More...
 
err_t noise_init (noise_t *ctx, noise_cfg_t *cfg)
 Initialization function. More...
 
void noise_default_cfg (noise_t *ctx)
 Click Default Configuration function. More...
 
void noise_write_cmd_reg (noise_t *ctx, uint16_t cmd_data)
 Write to Command Register. More...
 
err_t noise_set_cmd_reg (noise_t *ctx, uint8_t configuration, uint16_t threshold)
 Set Command Register. More...
 
void noise_set_state (noise_t *ctx, uint8_t state)
 Enable/disable click. More...
 
void noise_reset (noise_t *ctx)
 Reset Click. More...
 
uint8_t noise_check_int_pin (noise_t *ctx)
 Get INT pin state. More...
 
err_t noise_read_an_pin_value (noise_t *ctx, uint16_t *data_out)
 Noise read AN pin value function. More...
 
err_t noise_read_an_pin_voltage (noise_t *ctx, float *data_out)
 Noise read AN pin voltage level function. More...
 

Detailed Description

Function Documentation

◆ noise_cfg_setup()

void noise_cfg_setup ( noise_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ noise_check_int_pin()

uint8_t noise_check_int_pin ( noise_t ctx)

Get INT pin state.

Parameters
ctxClick object.
Returns
State of INT pin ( eighter 0 or 1 )

This function gets int pin state.

◆ noise_default_cfg()

void noise_default_cfg ( noise_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function performs default configuration for Noise click. Typically, it's setting threshold to default value.

◆ noise_init()

err_t noise_init ( noise_t ctx,
noise_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ noise_read_an_pin_value()

err_t noise_read_an_pin_value ( noise_t ctx,
uint16_t *  data_out 
)

Noise read AN pin value function.

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

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

◆ noise_read_an_pin_voltage()

err_t noise_read_an_pin_voltage ( noise_t ctx,
float *  data_out 
)

Noise read AN pin voltage level function.

This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See noise_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ noise_reset()

void noise_reset ( noise_t ctx)

Reset Click.

Parameters
ctxClick object.

This function performs click reset.

◆ noise_set_cmd_reg()

err_t noise_set_cmd_reg ( noise_t ctx,
uint8_t  configuration,
uint16_t  threshold 
)

Set Command Register.

Parameters
ctxClick object.
configurationConfiguration.
thresholdThreshold.

This function sets command register.

Returns
0 - success ; -1 - ( threshold value ) error
Note
Threshold is integer from [0, 4095] segment.
When measured noise level is above threshold, alarm is triggered. 

◆ noise_set_state()

void noise_set_state ( noise_t ctx,
uint8_t  state 
)

Enable/disable click.

Parameters
ctxClick object.
stateState to set click on.

This function switches click on or off.

◆ noise_write_cmd_reg()

void noise_write_cmd_reg ( noise_t ctx,
uint16_t  cmd_data 
)

Write to Command Register.

Parameters
ctxClick object.
cmd_dataCommand and data to send.

This function writes data to click's command register.