piezoaccel225g  2.1.0.0
Data Structures | Macros | Enumerations | Functions
piezoaccel225g.h File Reference

This file contains API for Piezo Accel 2 25g Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  piezoaccel225g_adc_data_t
 Piezo Accel 2 25g Click adc data object. More...
 
struct  piezoaccel225g_t
 Piezo Accel 2 25g Click context object. More...
 
struct  piezoaccel225g_cfg_t
 Piezo Accel 2 25g Click configuration object. More...
 

Macros

#define PIEZOACCEL225G_FAST_CMD_ADC_START   0x0A
 Piezo Accel 2 25g fast commands. More...
 
#define PIEZOACCEL225G_FAST_CMD_ADC_STANDBY   0x0B
 
#define PIEZOACCEL225G_FAST_CMD_ADC_SHUTDOWN   0x0C
 
#define PIEZOACCEL225G_FAST_CMD_FULL_SHUTDOWN   0x0D
 
#define PIEZOACCEL225G_FAST_CMD_FULL_RESET   0x0E
 
#define PIEZOACCEL225G_REG_ADCDATA   0x00
 Piezo Accel 2 25g registers list. More...
 
#define PIEZOACCEL225G_REG_CONFIG0   0x01
 
#define PIEZOACCEL225G_REG_CONFIG1   0x02
 
#define PIEZOACCEL225G_REG_CONFIG2   0x03
 
#define PIEZOACCEL225G_REG_CONFIG3   0x04
 
#define PIEZOACCEL225G_REG_IRQ   0x05
 
#define PIEZOACCEL225G_REG_MUX   0x06
 
#define PIEZOACCEL225G_REG_SCAN   0x07
 
#define PIEZOACCEL225G_REG_TIMER   0x08
 
#define PIEZOACCEL225G_REG_OFFSETCAL   0x09
 
#define PIEZOACCEL225G_REG_GAINCAL   0x0A
 
#define PIEZOACCEL225G_REG_LOCK   0x0D
 
#define PIEZOACCEL225G_REG_CRCCFG   0x0F
 
#define PIEZOACCEL225G_CONFIG0_VREF_SEL_INT_2_4_V   0x80
 Piezo Accel 2 25g CONFIG0 register setting. More...
 
#define PIEZOACCEL225G_CONFIG0_VREF_SEL_EXT   0x00
 
#define PIEZOACCEL225G_CONFIG0_VREF_SEL_MASK   0x80
 
#define PIEZOACCEL225G_CONFIG0_EXIT_PART_SHUTDOWN   0x40
 
#define PIEZOACCEL225G_CONFIG0_CLK_SEL_INT_CLKOUT   0x30
 
#define PIEZOACCEL225G_CONFIG0_CLK_SEL_INT   0x20
 
#define PIEZOACCEL225G_CONFIG0_CLK_SEL_EXT   0x00
 
#define PIEZOACCEL225G_CONFIG0_CLK_SEL_MASK   0x30
 
#define PIEZOACCEL225G_CONFIG0_CS_SEL_15_UA   0x0C
 
#define PIEZOACCEL225G_CONFIG0_CS_SEL_3_7_UA   0x08
 
#define PIEZOACCEL225G_CONFIG0_CS_SEL_0_9_UA   0x04
 
#define PIEZOACCEL225G_CONFIG0_CS_SEL_NO_IN_CURR   0x00
 
#define PIEZOACCEL225G_CONFIG0_CS_SEL_MASK   0x0C
 
#define PIEZOACCEL225G_CONFIG0_ADC_MODE_CONVERSION   0x03
 
#define PIEZOACCEL225G_CONFIG0_ADC_MODE_STANDBY   0x02
 
#define PIEZOACCEL225G_CONFIG0_ADC_MODE_SHUTDOWN   0x00
 
#define PIEZOACCEL225G_CONFIG0_ADC_MODE_MASK   0x03
 
#define PIEZOACCEL225G_CONFIG1_PRE_DIV_8   0xC0
 Piezo Accel 2 25g CONFIG1 register setting. More...
 
#define PIEZOACCEL225G_CONFIG1_PRE_DIV_4   0x80
 
#define PIEZOACCEL225G_CONFIG1_PRE_DIV_2   0x40
 
#define PIEZOACCEL225G_CONFIG1_PRE_DIV_1   0x00
 
#define PIEZOACCEL225G_CONFIG1_PRE_MASK   0xC0
 
#define PIEZOACCEL225G_CONFIG1_OSR_98304   0x3C
 
#define PIEZOACCEL225G_CONFIG1_OSR_81920   0x38
 
#define PIEZOACCEL225G_CONFIG1_OSR_49152   0x34
 
#define PIEZOACCEL225G_CONFIG1_OSR_40960   0x30
 
#define PIEZOACCEL225G_CONFIG1_OSR_24576   0x2C
 
#define PIEZOACCEL225G_CONFIG1_OSR_20480   0x28
 
#define PIEZOACCEL225G_CONFIG1_OSR_16384   0x24
 
#define PIEZOACCEL225G_CONFIG1_OSR_8192   0x20
 
#define PIEZOACCEL225G_CONFIG1_OSR_4096   0x1C
 
#define PIEZOACCEL225G_CONFIG1_OSR_2048   0x18
 
#define PIEZOACCEL225G_CONFIG1_OSR_1024   0x14
 
#define PIEZOACCEL225G_CONFIG1_OSR_512   0x10
 
#define PIEZOACCEL225G_CONFIG1_OSR_256   0x0C
 
#define PIEZOACCEL225G_CONFIG1_OSR_128   0x08
 
#define PIEZOACCEL225G_CONFIG1_OSR_64   0x04
 
#define PIEZOACCEL225G_CONFIG1_OSR_32   0x00
 
#define PIEZOACCEL225G_CONFIG1_OSR_MASK   0x3C
 
#define PIEZOACCEL225G_CONFIG2_BOOST_X2   0xC0
 Piezo Accel 2 25g CONFIG2 register setting. More...
 
#define PIEZOACCEL225G_CONFIG2_BOOST_X1   0x80
 
#define PIEZOACCEL225G_CONFIG2_BOOST_X0_66   0x40
 
#define PIEZOACCEL225G_CONFIG2_BOOST_X0_5   0x00
 
#define PIEZOACCEL225G_CONFIG2_BOOST_MASK   0xC0
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X64   0x38
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X32   0x30
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X16   0x28
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X8   0x20
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X4   0x18
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X2   0x10
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X1   0x08
 
#define PIEZOACCEL225G_CONFIG2_GAIN_X1_PER_3   0x00
 
#define PIEZOACCEL225G_CONFIG2_GAIN_MASK   0x38
 
#define PIEZOACCEL225G_CONFIG2_AZ_MUX_EN   0x04
 
#define PIEZOACCEL225G_CONFIG2_AZ_REF_EN   0x02
 
#define PIEZOACCEL225G_CONFIG2_RESERVED   0x01
 
#define PIEZOACCEL225G_CONFIG3_CONV_MODE_CONT   0xC0
 Piezo Accel 2 25g CONFIG3 register setting. More...
 
#define PIEZOACCEL225G_CONFIG3_CONV_MODE_ONES_STB   0x80
 
#define PIEZOACCEL225G_CONFIG3_CONV_MODE_ONES_SHD   0x00
 
#define PIEZOACCEL225G_CONFIG3_CONV_MODE_MASK   0xC0
 
#define PIEZOACCEL225G_CONFIG3_DATA_FMT_32B_R_CHID   0x30
 
#define PIEZOACCEL225G_CONFIG3_DATA_FMT_32B_R   0x20
 
#define PIEZOACCEL225G_CONFIG3_DATA_FMT_32B_L   0x10
 
#define PIEZOACCEL225G_CONFIG3_DATA_FMT_24B   0x00
 
#define PIEZOACCEL225G_CONFIG3_DATA_FMT_MASK   0x30
 
#define PIEZOACCEL225G_CONFIG3_CRC_FMT_32B   0x08
 
#define PIEZOACCEL225G_CONFIG3_CRC_FMT_16B   0x00
 
#define PIEZOACCEL225G_CONFIG3_CRC_FMT_MASK   0x08
 
#define PIEZOACCEL225G_CONFIG3_EN_CRCCOM   0x04
 
#define PIEZOACCEL225G_CONFIG3_EN_OFFCAL   0x02
 
#define PIEZOACCEL225G_CONFIG3_EN_GAINCAL   0x01
 
#define PIEZOACCEL225G_IRQ_DR_STATUS   0x40
 Piezo Accel 2 25g IRQ register setting. More...
 
#define PIEZOACCEL225G_IRQ_CRCCFG_STATUS   0x20
 
#define PIEZOACCEL225G_IRQ_POR_STATUS   0x10
 
#define PIEZOACCEL225G_IRQ_MODE1_MDAT   0x08
 
#define PIEZOACCEL225G_IRQ_MODE1_IRQOUT   0x00
 
#define PIEZOACCEL225G_IRQ_MODE1_MASK   0x08
 
#define PIEZOACCEL225G_IRQ_MODE0_INACT_HIGH   0x04
 
#define PIEZOACCEL225G_IRQ_MODE0_INACT_HIGH_Z   0x00
 
#define PIEZOACCEL225G_IRQ_MODE0_MASK   0x04
 
#define PIEZOACCEL225G_IRQ_EN_FAST_CMD   0x02
 
#define PIEZOACCEL225G_IRQ_EN_STP   0x01
 
#define PIEZOACCEL225G_SCAN_DLY_512_DMCLK   0xE00000ul
 Piezo Accel 2 25g SCAN register setting. More...
 
#define PIEZOACCEL225G_SCAN_DLY_256_DMCLK   0xC00000ul
 
#define PIEZOACCEL225G_SCAN_DLY_128_DMCL   0xA00000ul
 
#define PIEZOACCEL225G_SCAN_DLY_64_DMCLK   0x800000ul
 
#define PIEZOACCEL225G_SCAN_DLY_32_DMCLK   0x600000ul
 
#define PIEZOACCEL225G_SCAN_DLY_16_DMCLK   0x400000ul
 
#define PIEZOACCEL225G_SCAN_DLY_8_DMCLK   0x200000ul
 
#define PIEZOACCEL225G_SCAN_DLY_NO_DELAY   0x000000ul
 
#define PIEZOACCEL225G_SCAN_DLY_MASK   0xE00000ul
 
#define PIEZOACCEL225G_SCAN_CH_OFFSET   0x008000ul
 
#define PIEZOACCEL225G_SCAN_CH_VCM   0x004000ul
 
#define PIEZOACCEL225G_SCAN_CH_AVDD   0x002000ul
 
#define PIEZOACCEL225G_SCAN_CH_TEMP   0x001000ul
 
#define PIEZOACCEL225G_SCAN_CH_DIFF_CH2_CH3   0x000200ul
 
#define PIEZOACCEL225G_SCAN_CH_DIFF_CH0_CH1   0x000100ul
 
#define PIEZOACCEL225G_SCAN_CH_SINGLE_ENDED_CH3   0x000008ul
 
#define PIEZOACCEL225G_SCAN_CH_SINGLE_ENDED_CH2   0x000004ul
 
#define PIEZOACCEL225G_SCAN_CH_SINGLE_ENDED_CH1   0x000002ul
 
#define PIEZOACCEL225G_SCAN_CH_SINGLE_ENDED_CH0   0x000001ul
 
#define PIEZOACCEL225G_STATUS_DEV_ADDR_MASK   0x30
 Piezo Accel 2 25g status byte setting. More...
 
#define PIEZOACCEL225G_STATUS_DEV_ADDR_FLAG   0x08
 
#define PIEZOACCEL225G_STATUS_DR_FLAG   0x04
 
#define PIEZOACCEL225G_STATUS_CRCCFG_FLAG   0x02
 
#define PIEZOACCEL225G_STATUS_POR_FLAG   0x01
 
#define PIEZOACCEL225G_CMD_TYPE_FAST_CMD   0x00
 Piezo Accel 2 25g command type setting. More...
 
#define PIEZOACCEL225G_CMD_TYPE_STATIC_REG_READ   0x01
 
#define PIEZOACCEL225G_CMD_TYPE_INC_REG_WRITE   0x02
 
#define PIEZOACCEL225G_CMD_TYPE_INC_REG_READ   0x03
 
#define PIEZOACCEL225G_CMD_DEV_ADDR   0x01
 Piezo Accel 2 25g device address setting. More...
 
#define PIEZOACCEL225G_LOCK_BYTE   0x00
 Piezo Accel 2 25g lock setting. More...
 
#define PIEZOACCEL225G_UNLOCK_BYTE   0xA5
 
#define PIEZOACCEL225G_DATA_READY_TIMEOUT_MS   1000
 Piezo Accel 2 25g data ready timeout setting. More...
 
#define PIEZOACCEL225G_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection. More...
 
#define PIEZOACCEL225G_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define PIEZOACCEL225G_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  piezoaccel225g_return_value_t { PIEZOACCEL225G_OK = 0, PIEZOACCEL225G_ERROR = -1 }
 Piezo Accel 2 25g Click return value data. More...
 

Functions

void piezoaccel225g_cfg_setup (piezoaccel225g_cfg_t *cfg)
 Piezo Accel 2 25g configuration object setup function. More...
 
err_t piezoaccel225g_init (piezoaccel225g_t *ctx, piezoaccel225g_cfg_t *cfg)
 Piezo Accel 2 25g initialization function. More...
 
err_t piezoaccel225g_default_cfg (piezoaccel225g_t *ctx)
 Piezo Accel 2 25g default configuration function. More...
 
err_t piezoaccel225g_fast_cmd_write (piezoaccel225g_t *ctx, uint8_t fast_cmd)
 Piezo Accel 2 25g fast cmd write function. More...
 
err_t piezoaccel225g_reg_write_multi (piezoaccel225g_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Piezo Accel 2 25g reg write multi function. More...
 
err_t piezoaccel225g_reg_write_8 (piezoaccel225g_t *ctx, uint8_t reg, uint8_t data_in)
 Piezo Accel 2 25g reg write 8 function. More...
 
err_t piezoaccel225g_reg_write_24 (piezoaccel225g_t *ctx, uint8_t reg, uint32_t data_in)
 Piezo Accel 2 25g reg write 24 function. More...
 
err_t piezoaccel225g_reg_read_multi (piezoaccel225g_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Piezo Accel 2 25g reg read multi function. More...
 
err_t piezoaccel225g_reg_read_8 (piezoaccel225g_t *ctx, uint8_t reg, uint8_t *data_out)
 Piezo Accel 2 25g reg read 8 function. More...
 
err_t piezoaccel225g_reg_read_24 (piezoaccel225g_t *ctx, uint8_t reg, uint32_t *data_out)
 Piezo Accel 2 25g reg read 24 function. More...
 
err_t piezoaccel225g_reg_read_32 (piezoaccel225g_t *ctx, uint8_t reg, uint32_t *data_out)
 Piezo Accel 2 25g reg read 32 function. More...
 
err_t piezoaccel225g_unlock_reg_write (piezoaccel225g_t *ctx)
 Piezo Accel 2 25g unlock reg write function. More...
 
err_t piezoaccel225g_lock_reg_write (piezoaccel225g_t *ctx)
 Piezo Accel 2 25g lock reg write function. More...
 
uint8_t piezoaccel225g_get_clk_pin (piezoaccel225g_t *ctx)
 Piezo Accel 2 25g get clk pin function. More...
 
uint8_t piezoaccel225g_get_irq_pin (piezoaccel225g_t *ctx)
 Piezo Accel 2 25g get irq pin function. More...
 
err_t piezoaccel225g_wait_data_ready (piezoaccel225g_t *ctx, uint16_t timeout_ms)
 Piezo Accel 2 25g wait data ready function. More...
 
err_t piezoaccel225g_read_adc_data (piezoaccel225g_t *ctx, piezoaccel225g_adc_data_t *data_out)
 Piezo Accel 2 25g read adc data function. More...
 

Detailed Description

This file contains API for Piezo Accel 2 25g Click Driver.

Enumeration Type Documentation

◆ piezoaccel225g_return_value_t

Piezo Accel 2 25g Click return value data.

Predefined enum values for driver return values.

Enumerator
PIEZOACCEL225G_OK 
PIEZOACCEL225G_ERROR