smoke2 2.0.0.0
Smoke 2 Click Driver

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

Topics

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

Functions

void smoke2_cfg_setup (smoke2_cfg_t *cfg)
 Smoke 2 configuration object setup function.
 
void smoke2_drv_interface_selection (smoke2_cfg_t *cfg, smoke2_drv_t drv_sel)
 Smoke 2 driver interface setup function.
 
err_t smoke2_init (smoke2_t *ctx, smoke2_cfg_t *cfg)
 Smoke 2 initialization function.
 
void smoke2_default_cfg (smoke2_t *ctx)
 Smoke 2 default configuration function.
 
err_t smoke2_generic_write (smoke2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Smoke 2 data writing function.
 
err_t smoke2_generic_read (smoke2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smoke 2 data reading function.
 
uint8_t smoke2_get_int_pin (smoke2_t *ctx)
 Smoke 2 get state of int pin function.
 
void smoke2_write_data (smoke2_t *ctx, uint8_t reg, uint16_t tx_data)
 Smoke 2 generic function for writing data to register function.
 
uint16_t smoke2_read_data (smoke2_t *ctx, uint8_t reg)
 Smoke 2 generic function for reading data from registar.
 
void smoke2_set_bit (smoke2_t *ctx, uint8_t reg, uint8_t bit_num, uint8_t val)
 Smoke 2 generic function for writing bit state.
 
uint8_t smoke2_get_bit (smoke2_t *ctx, uint8_t reg, uint8_t bit_num)
 Smoke 2 generic function for reading bit state.
 
void smoke2_set_mode (smoke2_t *ctx, uint8_t mode)
 Smoke 2 setting mode function.
 
void smoke2_get_int (smoke2_t *ctx, uint8_t *fifo, uint8_t *slot_a, uint8_t *slot_b)
 Smoke 2 get mode function.
 
uint16_t smoke2_read_sens_data (smoke2_t *ctx, uint8_t slot, uint8_t chn)
 Smoke 2 reading bit state function.
 
void smoke2_soft_reset (smoke2_t *ctx)
 Smoke 2 reseting device function.
 
uint16_t smoke2_smoke_calibration (smoke2_t *ctx, uint16_t threshold)
 Smoke 2 calibrating data and setting threshold function.
 
uint8_t smoke2_check_smoke (smoke2_t *ctx)
 Smoke 2 checking smoke detection function.
 

Detailed Description

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

◆ smoke2_cfg_setup()

void smoke2_cfg_setup ( smoke2_cfg_t * cfg)

Smoke 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ smoke2_check_smoke()

uint8_t smoke2_check_smoke ( smoke2_t * ctx)

Smoke 2 checking smoke detection function.

This function checking smoke detection of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
Returns
SMOKE2_SMOKE_DETECTED or SMOKE2_SMOKE_NOT_DETECTED macro.
Note
None.

◆ smoke2_default_cfg()

void smoke2_default_cfg ( smoke2_t * ctx)

Smoke 2 default configuration function.

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

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
Returns
Nothing.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ smoke2_drv_interface_selection()

void smoke2_drv_interface_selection ( smoke2_cfg_t * cfg,
smoke2_drv_t drv_sel )

Smoke 2 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See smoke2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See smoke2_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ smoke2_generic_read()

err_t smoke2_generic_read ( smoke2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Smoke 2 data reading function.

This function reads a desired number of data bytes starting from the selected register.

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

◆ smoke2_generic_write()

err_t smoke2_generic_write ( smoke2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Smoke 2 data writing function.

This function writes a desired number of data bytes starting from the selected register.

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

◆ smoke2_get_bit()

uint8_t smoke2_get_bit ( smoke2_t * ctx,
uint8_t reg,
uint8_t bit_num )

Smoke 2 generic function for reading bit state.

This function is generic for reading bit state of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]reg: register address.
[in]bit_num: bit to be written.
Returns
Read data.
Note
None.

◆ smoke2_get_int()

void smoke2_get_int ( smoke2_t * ctx,
uint8_t * fifo,
uint8_t * slot_a,
uint8_t * slot_b )

Smoke 2 get mode function.

This function get mode of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[out]fifo: fifo data.
[out]slot_a: slot a int.
[out]slot_b: slot b int.
Returns
Nothing.
Note
None.

◆ smoke2_get_int_pin()

uint8_t smoke2_get_int_pin ( smoke2_t * ctx)

Smoke 2 get state of int pin function.

This function eget state of int pin of Smoke 2 click board.

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

◆ smoke2_init()

err_t smoke2_init ( smoke2_t * ctx,
smoke2_cfg_t * cfg )

Smoke 2 initialization function.

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

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

◆ smoke2_read_data()

uint16_t smoke2_read_data ( smoke2_t * ctx,
uint8_t reg )

Smoke 2 generic function for reading data from registar.

This function is generic for reading data from registar of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]reg: register address.
Returns
Read data.
Note
None.

◆ smoke2_read_sens_data()

uint16_t smoke2_read_sens_data ( smoke2_t * ctx,
uint8_t slot,
uint8_t chn )

Smoke 2 reading bit state function.

This function reading bit state of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]slot: slot to be read.
[in]chn: channel to be read
Returns
Read data.
Note
None.

◆ smoke2_set_bit()

void smoke2_set_bit ( smoke2_t * ctx,
uint8_t reg,
uint8_t bit_num,
uint8_t val )

Smoke 2 generic function for writing bit state.

This function is generic for writing bit state of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]reg: register address.
[in]bit_num: bit to be written.
[in]val: value to be written.
Returns
Nothing.
Note
None.

◆ smoke2_set_mode()

void smoke2_set_mode ( smoke2_t * ctx,
uint8_t mode )

Smoke 2 setting mode function.

This function setting mode of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]mode: device mode.
Returns
Nothing.
Note
None.

◆ smoke2_smoke_calibration()

uint16_t smoke2_smoke_calibration ( smoke2_t * ctx,
uint16_t threshold )

Smoke 2 calibrating data and setting threshold function.

This function calibrating data and setting threshold of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]threshold: threshold for smoke detection.
Returns
Calibrated data.
Note
None.

◆ smoke2_soft_reset()

void smoke2_soft_reset ( smoke2_t * ctx)

Smoke 2 reseting device function.

This function reseting device of Smoke 2 click board.

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

◆ smoke2_write_data()

void smoke2_write_data ( smoke2_t * ctx,
uint8_t reg,
uint16_t tx_data )

Smoke 2 generic function for writing data to register function.

This function is generic for writing data to register of Smoke 2 click board.

Parameters
[in]ctx: Click context object. See smoke2_t object definition for detailed explanation.
[in]reg: register address.
[in]tx_data: data to be written.
Returns
Nothing.
Note
None.