apc1sensor 2.1.0.0
apc1sensor.h File Reference

This file contains API for APC1 Sensor Demo Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  apc1sensor_t
 APC1 Sensor Demo context object. More...
 
struct  apc1sensor_cfg_t
 APC1 Sensor Demo configuration object. More...
 
struct  apc1sensor_measurement_t
 APC1 Sensor Demo measurement data object. More...
 
struct  apc1sensor_info_t
 APC1 Sensor Demo module type, ID and firmware version object. More...
 

Macros

#define APC1SENSOR_ADDRESS_CMD   0x40
 APC1 Sensor commands definition.
 
#define APC1SENSOR_ADDRESS_RESPONSE   0x47
 
#define APC1SENSOR_CMD_SET_MEAS_MODE   0xE1
 
#define APC1SENSOR_CMD_REQ_MEASUREMENT   0xE2
 
#define APC1SENSOR_CMD_SET_MODE   0xE4
 
#define APC1SENSOR_CMD_GET_INFO   0xE9
 
#define APC1SENSOR_HEADER_0   0x42
 APC1 Sensor header bytes definition.
 
#define APC1SENSOR_HEADER_1   0x4D
 
#define APC1SENSOR_MEASUREMENT_PASSIVE   0x00
 APC1 Sensor measurement mode definition.
 
#define APC1SENSOR_MEASUREMENT_ACTIVE   0x01
 
#define APC1SENSOR_MODE_IDLE   0x00
 APC1 Sensor commands mode definition.
 
#define APC1SENSOR_MODE_MEASUREMENT   0x01
 
#define APC1SENSOR_MODE_RESET   0x0F
 
#define APC1SENSOR_OPMODE_NORMAL   0
 APC1 Sensor operating mode setting.
 
#define APC1SENSOR_OPMODE_DEEP_SLEEP   1
 
#define APC1SENSOR_OPMODE_RESET   2
 
#define APC1SENSOR_TX_DRV_BUFFER_SIZE   100
 APC1 Sensor driver buffer size.
 
#define APC1SENSOR_RX_DRV_BUFFER_SIZE   300
 
#define APC1SENSOR_DEVICE_ADDRESS   0x12
 APC1 Sensor device address setting.
 
#define APC1SENSOR_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  apc1sensor_drv_t { APC1SENSOR_DRV_SEL_I2C , APC1SENSOR_DRV_SEL_UART }
 APC1 Sensor Click driver selector. More...
 
enum  apc1sensor_return_value_t { APC1SENSOR_OK = 0 , APC1SENSOR_ERROR = -1 }
 APC1 Sensor Demo return value data. More...
 

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

This file contains API for APC1 Sensor Demo Driver.

Enumeration Type Documentation

◆ apc1sensor_drv_t

APC1 Sensor Click driver selector.

Selects target driver interface of APC1 Sensor Click driver.

Enumerator
APC1SENSOR_DRV_SEL_I2C 

UART driver descriptor.

APC1SENSOR_DRV_SEL_UART 

I2C driver descriptor.

◆ apc1sensor_return_value_t

APC1 Sensor Demo return value data.

Predefined enum values for driver return values.

Enumerator
APC1SENSOR_OK 
APC1SENSOR_ERROR