moisture 2.0.0.0
Public function

Functions

void moisture_cfg_setup (moisture_cfg_t *cfg)
 Config Object Initialization function.
 
MOISTURE_RETVAL moisture_init (moisture_t *ctx, moisture_cfg_t *cfg)
 Initialization function.
 
void moisture_default_cfg (moisture_t *ctx)
 Click Default Configuration function.
 
void moisture_generic_write (moisture_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void moisture_generic_read (moisture_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void moisture_write_word (moisture_t *ctx, uint8_t reg, uint16_t data_in)
 Write word function.
 
uint16_t moisture_read_word (moisture_t *ctx, uint8_t reg)
 Read word function.
 
void moisture_soft_reset (moisture_t *ctx)
 Soft reset function.
 
void moisture_cfg (moisture_t *ctx, uint16_t gain, uint16_t offset, uint16_t clk_div)
 Configure device function.
 
uint8_t moisture_get_data (moisture_t *ctx)
 Measurement data function.
 
void moisture_cal (moisture_t *ctx)
 Chip calibration function.
 
uint8_t moisture_check_interrupt (moisture_t *ctx)
 Soft reset function.
 

Detailed Description

Function Documentation

◆ moisture_cal()

void moisture_cal ( moisture_t * ctx)

Chip calibration function.

Parameters
ctxClick object.

@description Functions is used to calibrate the device.

Note
Don't touch the sensor while calibrating!

◆ moisture_cfg()

void moisture_cfg ( moisture_t * ctx,
uint16_t gain,
uint16_t offset,
uint16_t clk_div )

Configure device function.

Parameters
ctxClick object.
gainSelect moisture gain data.
offsetSelect offset data.
clk_divSelect clock divider.

@description Functions is used to configure moisture gain, offset and clock divider.

   MOISTURE_REG_RESET_DEV
 -------------------------------------------
   gain
 
   MOISTURE_REG_SETTLE_CNT
 -------------------------------------------
   MOISTURE_SETTLE_CNT_CFG_DEFAULT
 
   MOISTURE_REG_RCNT
 -------------------------------------------
   MOISTURE_RCNT_CFG_DEFAULT
 
   MOISTURE_REG_OFFSET
 -------------------------------------------
   offset
 
   MOISTURE_REG_CLOCK_DIVIDERS
 -------------------------------------------
   MOISTURE_COMBINED_VAL_CH0_DIV
   clk_div
 
   MOISTURE_REG_DRIVE_CURR
 -------------------------------------------
   MOISTURE_DRIVE_CURR_CH0
 
   MOISTURE_REG_ERR_CFG
 -------------------------------------------
   MOISTURE_ALL_ERR_ENABLED
 
   MOISTURE_REG_CFG
 -------------------------------------------
   MOISTURE_REG_CFG_DEFAULT_SETTINGS
 
   MOISTURE_REG_MUX_CFG
 -------------------------------------------
   MOISTURE_INPUT_DEGLITCH_FILT_BWDTH_33MHZ
 

◆ moisture_cfg_setup()

void moisture_cfg_setup ( moisture_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ moisture_check_interrupt()

uint8_t moisture_check_interrupt ( moisture_t * ctx)

Soft reset function.

Parameters
ctxClick object.
Return values
state0 - no interrupt / 1 - interrupt has occured.

@description This function checks if interrupt has occured.

◆ moisture_default_cfg()

void moisture_default_cfg ( moisture_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Moisture click.

  MOISTURE_REG_RESET_DEV
-------------------------------------------
  MOISTURE_OUTPUT_GAIN_x16

MOISTURE_REG_SETTLE_CNT

  MOISTURE_SETTLE_CNT_CFG_DEFAULT
  MOISTURE_REG_RCNT
-------------------------------------------
  MOISTURE_RCNT_CFG_DEFAULT

MOISTURE_REG_OFFSET

  MOISTURE_DEFAULT_OFFSET
  MOISTURE_REG_CLOCK_DIVIDERS
-------------------------------------------
  MOISTURE_COMBINED_VAL_CH0_DIV
  MOISTURE_CLOCK_DIVIDERS_x10

MOISTURE_REG_DRIVE_CURR

  MOISTURE_DRIVE_CURR_CH0
  MOISTURE_REG_ERR_CFG
-------------------------------------------
  MOISTURE_ALL_ERR_ENABLED

MOISTURE_REG_CFG

  MOISTURE_REG_CFG_DEFAULT_SETTINGS
  MOISTURE_REG_MUX_CFG
-------------------------------------------
  MOISTURE_INPUT_DEGLITCH_FILT_BWDTH_33MHZ

◆ moisture_generic_read()

void moisture_generic_read ( moisture_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ moisture_generic_write()

void moisture_generic_write ( moisture_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ moisture_get_data()

uint8_t moisture_get_data ( moisture_t * ctx)

Measurement data function.

Parameters
ctxClick object.
Return values
moistureData in percent.

@description Functions is used to measure moisture.

Note
Moisture data depends on the set gain, offset and clock divider.

◆ moisture_init()

MOISTURE_RETVAL moisture_init ( moisture_t * ctx,
moisture_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ moisture_read_word()

uint16_t moisture_read_word ( moisture_t * ctx,
uint8_t reg )

Read word function.

Parameters
ctxClick object.
regRegister which will be read.
Return values
resultTwo byte data which is read from the register.

@description This function reads one word from the desired register.

◆ moisture_soft_reset()

void moisture_soft_reset ( moisture_t * ctx)

Soft reset function.

Parameters
ctxClick object.

@description This function performs soft reset.

◆ moisture_write_word()

void moisture_write_word ( moisture_t * ctx,
uint8_t reg,
uint16_t data_in )

Write word function.

Parameters
ctxClick object.
regRegister in which the data will be written.
data_inData which will be written in the register.

@description This function writes word to the desired register.