apc1sensor 2.1.0.0
APC1 Sensor Demo Driver

API for configuring and manipulating APC1 Sensor Demo driver. More...

Topics

 APC1 Sensor Commands List
 List of commands of APC1 Sensor Demo driver.
 
 APC1 Sensor Registers Settings
 Settings for registers of APC1 Sensor Demo driver.
 
 APC1 Sensor MikroBUS Map
 MikroBUS pin mapping of APC1 Sensor Demo driver.
 

Functions

void apc1sensor_cfg_setup (apc1sensor_cfg_t *cfg)
 APC1 Sensor configuration object setup function.
 
void apc1sensor_drv_interface_sel (apc1sensor_cfg_t *cfg, apc1sensor_drv_t drv_sel)
 APC1 Sensor driver interface setup function.
 
err_t apc1sensor_init (apc1sensor_t *ctx, apc1sensor_cfg_t *cfg)
 APC1 Sensor initialization function.
 
err_t apc1sensor_default_cfg (apc1sensor_t *ctx)
 APC1 Sensor default configuration function.
 
err_t apc1sensor_set_idle_mode (apc1sensor_t *ctx)
 APC1 Sensor set idle mode function.
 
err_t apc1sensor_start_measurement (apc1sensor_t *ctx)
 APC1 Sensor start measurement function.
 
err_t apc1sensor_sw_reset (apc1sensor_t *ctx)
 APC1 Sensor sw reset function.
 
err_t apc1sensor_set_meas_mode (apc1sensor_t *ctx, uint8_t mode)
 APC1 Sensor set meas mode function.
 
err_t apc1sensor_request_meas (apc1sensor_t *ctx)
 APC1 Sensor request meas function.
 
err_t apc1sensor_read_info (apc1sensor_t *ctx, apc1sensor_info_t *info)
 APC1 Sensor read info function.
 
err_t apc1sensor_read_measurement (apc1sensor_t *ctx, apc1sensor_measurement_t *measurement)
 APC1 Sensor read measurement function.
 
void apc1sensor_set_opmode (apc1sensor_t *ctx, uint8_t opmode)
 APC1 Sensor set opmode function.
 
void apc1sensor_reset_device (apc1sensor_t *ctx)
 APC1 Sensor reset device function.
 

Detailed Description

API for configuring and manipulating APC1 Sensor Demo driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ apc1sensor_cfg_setup()

void apc1sensor_cfg_setup ( apc1sensor_cfg_t * cfg)

APC1 Sensor configuration object setup function.

This function initializes demo configuration structure to initial values.

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

◆ apc1sensor_default_cfg()

err_t apc1sensor_default_cfg ( apc1sensor_t * ctx)

APC1 Sensor default configuration function.

This function executes a default configuration of APC1 Sensor demo board.

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

◆ apc1sensor_drv_interface_sel()

void apc1sensor_drv_interface_sel ( apc1sensor_cfg_t * cfg,
apc1sensor_drv_t drv_sel )

APC1 Sensor 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 apc1sensor_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See apc1sensor_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called 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.

◆ apc1sensor_init()

err_t apc1sensor_init ( apc1sensor_t * ctx,
apc1sensor_cfg_t * cfg )

APC1 Sensor initialization function.

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

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

◆ apc1sensor_read_info()

err_t apc1sensor_read_info ( apc1sensor_t * ctx,
apc1sensor_info_t * info )

APC1 Sensor read info function.

This function reads the device name, serial number, and firmware version.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
[out]info: Device info object. See apc1sensor_info_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_read_measurement()

err_t apc1sensor_read_measurement ( apc1sensor_t * ctx,
apc1sensor_measurement_t * measurement )

APC1 Sensor read measurement function.

This function reads the measurement 64-bytes output structure data.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
[out]measurement: Measurement output object. See apc1sensor_measurement_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_request_meas()

err_t apc1sensor_request_meas ( apc1sensor_t * ctx)

APC1 Sensor request meas function.

This function requests measurement in passive measurement mode (UART only).

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_reset_device()

void apc1sensor_reset_device ( apc1sensor_t * ctx)

APC1 Sensor reset device function.

This function resets the device by toggling the RST pin state.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ apc1sensor_set_idle_mode()

err_t apc1sensor_set_idle_mode ( apc1sensor_t * ctx)

APC1 Sensor set idle mode function.

This function sets the device to IDLE mode.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_set_meas_mode()

err_t apc1sensor_set_meas_mode ( apc1sensor_t * ctx,
uint8_t mode )

APC1 Sensor set meas mode function.

This function sets measurement mode to active or passive (UART only).

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
[in]mode:
  • 0 - Passive,
  • 1 - Active.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_set_opmode()

void apc1sensor_set_opmode ( apc1sensor_t * ctx,
uint8_t opmode )

APC1 Sensor set opmode function.

This function sets the operation mode by setting the SET and RST pins state.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
[in]opmode:
  • 0 - Normal,
  • 1 - Deep sleep,
  • 2 - Reset.
Returns
None.
Note
None.

◆ apc1sensor_start_measurement()

err_t apc1sensor_start_measurement ( apc1sensor_t * ctx)

APC1 Sensor start measurement function.

This function starts measurement by setting the device to measurement mode.

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ apc1sensor_sw_reset()

err_t apc1sensor_sw_reset ( apc1sensor_t * ctx)

APC1 Sensor sw reset function.

This function performs a device software reset (I2C only).

Parameters
[in]ctx: Demo context object. See apc1sensor_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.