rng 2.0.0.0
rng.h File Reference

This file contains API for RNG Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  rng_t
 Click ctx object definition. More...
 
struct  rng_cfg_t
 Click configuration structure definition. More...
 

Macros

#define RNG_MAP_MIKROBUS(cfg, mikrobus)
 
#define RNG_RETVAL   uint8_t
 
#define RNG_OK   0x00
 
#define RNG_INIT_ERROR   0xFF
 
#define RNG_DEVICE_SLAVE_ADDRESS_GND   0x48
 
#define RNG_DEVICE_SLAVE_ADDRESS_VDD   0x49
 
#define RNG_DEVICE_SLAVE_ADDRESS_SDA   0x4A
 
#define RNG_DEVICE_SLAVE_ADDRESS_SCL   0x4B
 
#define RNG_RESET_DEVICE   0x06
 
#define RNG_CONVERSION_REG   0x00
 
#define RNG_CONFIG_REG   0x01
 
#define RNG_LO_THRESH_REG   0x02
 
#define RNG_HI_THRESH_REG   0x03
 
#define RNG_CONFIG_REG_COMP_QUEUE_DISABLE   0x0003
 
#define RNG_CONFIG_REG_COMP_QUEUE_4_CONV   0x0002
 
#define RNG_CONFIG_REG_COMP_QUEUE_2_CONV   0x0001
 
#define RNG_CONFIG_REG_COMP_QUEUE_1_CONV   0x0000
 
#define RNG_CONFIG_REG_COMP_LAT_NON   0x0000
 
#define RNG_CONFIG_REG_COMP_LAT   0x0004
 
#define RNG_CONFIG_REG_COMP_POL_LOW   0x0000
 
#define RNG_CONFIG_REG_COMP_POL_HIGH   0x0008
 
#define RNG_CONFIG_REG_COMP_MODE_TRAD   0x0000
 
#define RNG_CONFIG_REG_COMP_MODE_WINDOW   0x0010
 
#define RNG_CONFIG_REG_DATA_RATE_8_SPS   0x0000
 
#define RNG_CONFIG_REG_DATA_RATE_16_SPS   0x0020
 
#define RNG_CONFIG_REG_DATA_RATE_32_SPS   0x0040
 
#define RNG_CONFIG_REG_DATA_RATE_64_SPS   0x0060
 
#define RNG_CONFIG_REG_DATA_RATE_128_SPS   0x0080
 
#define RNG_CONFIG_REG_DATA_RATE_250_SPS   0x00A0
 
#define RNG_CONFIG_REG_DATA_RATE_475_SPS   0x00C0
 
#define RNG_CONFIG_REG_DATA_RATE_860_SPS   0x00E0
 
#define RNG_CONFIG_REG_DEV_MODE_SINGLE   0x0100
 
#define RNG_CONFIG_REG_DEV_MODE_CONTIN   0x0000
 
#define RNG_CONFIG_REG_PGA_6144   0x0000
 
#define RNG_CONFIG_REG_PGA_4096   0x0200
 
#define RNG_CONFIG_REG_PGA_2048   0x0400
 
#define RNG_CONFIG_REG_PGA_1024   0x0600
 
#define RNG_CONFIG_REG_PGA_512   0x0800
 
#define RNG_CONFIG_REG_PGA_256_1   0x0A00
 
#define RNG_CONFIG_REG_PGA_256_2   0x0C00
 
#define RNG_CONFIG_REG_PGA_256_3   0x0E00
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_0_1   0x0000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_0_3   0x1000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_1_3   0x2000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_2_3   0x3000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_0_GND   0x4000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_1_GND   0x5000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_2_GND   0x6000
 
#define RNG_CONFIG_REG_MUX_AINP_AINN_3_GND   0x7000
 
#define RNG_CONFIG_REG_OS_SINGLE_CONV   0x8000
 
#define RNG_CONFIG_REG_OS_NO_EFFECT   0x0000
 
#define RNG_REG_LOWTHRES_HOLD   0x8000
 
#define RNG_REG_HIGH_THRESH_HOLD   0x7FFF
 

Functions

void rng_cfg_setup (rng_cfg_t *cfg)
 Config Object Initialization function.
 
RNG_RETVAL rng_init (rng_t *ctx, rng_cfg_t *cfg)
 Initialization function.
 
void rng_default_cfg (rng_t *ctx)
 Click Default Configuration function.
 
void rng_write_function (rng_t *ctx, uint8_t reg, uint16_t reg_data)
 Write function.
 
uint16_t rng_read_function (rng_t *ctx, uint8_t reg)
 Read function.
 
void rng_reset_device (rng_t *ctx)
 Function used for reset device.
 
void rng_set_config (rng_t *ctx, uint16_t conf_data)
 Function used for set configuration.
 
void rng_set_vref (rng_t *ctx, uint16_t vref_mv)
 Function used for set vref in millivolts.
 
float rng_get_voltage (rng_t *ctx)
 Function used for get voltage.
 
void rng_set_threshold (rng_t *ctx, uint8_t thresh_reg, uint16_t thresh_data)
 Function used for set threshold values.
 

Detailed Description

This file contains API for RNG Click driver.