pot4 2.1.0.0
pot4.h File Reference

This file contains API for POT 4 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  pot4_t
 POT 4 Click context object. More...
 
struct  pot4_cfg_t
 POT 4 Click configuration object. More...
 

Macros

#define POT4_PERCENTS   100
 POT 4 potentiometer setting.
 
#define POT4_ROUND_TO_NEAREST_INT   0.5
 
#define POT4_ADC_RESOLUTION   0x0FFF
 POT 4 ADC setting.
 
#define POT4_VREF_3V3   3.3
 
#define POT4_VREF_5V   5.0
 
#define POT4_SET_DEV_ADDR   0x4D
 POT 4 device address setting.
 
#define POT4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  pot4_drv_t { POT4_DRV_SEL_ADC , POT4_DRV_SEL_I2C }
 POT 4 Click driver selector. More...
 
enum  pot4_return_value_t { POT4_OK = 0 , POT4_ERROR = -1 }
 POT 4 Click return value data. More...
 

Functions

void pot4_cfg_setup (pot4_cfg_t *cfg)
 POT 4 configuration object setup function.
 
void pot4_drv_interface_selection (pot4_cfg_t *cfg, pot4_drv_t drv_sel)
 POT 4 driver interface setup function.
 
err_t pot4_init (pot4_t *ctx, pot4_cfg_t *cfg)
 POT 4 initialization function.
 
err_t pot4_read_raw_adc (pot4_t *ctx, uint16_t *raw_adc)
 POT 4 read raw ADC value function.
 
err_t pot4_read_voltage (pot4_t *ctx, float *voltage)
 POT 4 read voltage level function.
 
err_t pot4_set_vref (pot4_t *ctx, float vref)
 POT 4 set vref function.
 
uint8_t pot4_get_switch_pin (pot4_t *ctx)
 POT 4 get switch pin function.
 
uint8_t pot4_convert_voltage_to_percents (pot4_t *ctx, float voltage)
 POT 4 convert voltage to percents function.
 

Detailed Description

This file contains API for POT 4 Click Driver.

Enumeration Type Documentation

◆ pot4_drv_t

enum pot4_drv_t

POT 4 Click driver selector.

Selects target driver interface of POT 4 Click driver.

Enumerator
POT4_DRV_SEL_ADC 

ADC driver descriptor.

POT4_DRV_SEL_I2C 

I2C driver descriptor.

◆ pot4_return_value_t

POT 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
POT4_OK 
POT4_ERROR