knob 2.0.0.0
knob.h File Reference

This file contains API for Knob 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  knob_t
 Click ctx object definition. More...
 
struct  knob_cfg_t
 Click configuration structure definition. More...
 

Macros

#define KNOB_MAP_MIKROBUS(cfg, mikrobus)
 
#define KNOB_RETVAL   uint8_t
 
#define KNOB_OK   0x00
 
#define KNOB_INIT_ERROR   0xFF
 
#define KNOB_REG_MODE_1   0x00
 
#define KNOB_REG_MODE_2   0x01
 
#define KNOB_REG_LED_OUTPUT_STATE_0   0x02
 
#define KNOB_REG_LED_OUTPUT_STATE_1   0x03
 
#define KNOB_REG_LED_OUTPUT_STATE_2   0x04
 
#define KNOB_REG_LED_OUTPUT_STATE_3   0x05
 
#define KNOB_REG_LED_OUTPUT_STATE_4   0x06
 
#define KNOB_REG_LED_OUTPUT_STATE_5   0x07
 
#define KNOB_REG_GROUP_DUTY_CYCLE_CONTROL   0x08
 
#define KNOB_REG_GROUP_FREQUENCY   0x09
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_0   0x0A
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_1   0x0B
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_2   0x0C
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_3   0x0D
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_4   0x0E
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_5   0x0F
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_6   0x10
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_7   0x11
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_8   0x12
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_9   0x13
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_10   0x14
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_11   0x15
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_12   0x16
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_13   0x17
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_14   0x18
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_15   0x19
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_16   0x1A
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_17   0x1B
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_18   0x1C
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_19   0x1D
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_20   0x1E
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_21   0x1F
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_22   0x20
 
#define KNOB_REG_BRIGHTNESS_CONTROL_LED_23   0x21
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_0   0x22
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_1   0x23
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_2   0x24
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_3   0x25
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_4   0x26
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_5   0x27
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_6   0x28
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_7   0x29
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_8   0x2A
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_9   0x2B
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_10   0x2C
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_11   0x2D
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_12   0x2E
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_13   0x2F
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_14   0x30
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_15   0x31
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_16   0x32
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_17   0x33
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_18   0x34
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_19   0x35
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_20   0x36
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_21   0x37
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_22   0x38
 
#define KNOB_REG_OUTPUT_GAIN_CONTROL_23   0x39
 
#define KNOB_REG_OFFSET   0x3A
 
#define KNOB_REG_I2C_BUS_SUBADDRESS_1   0x3B
 
#define KNOB_REG_I2C_BUS_SUBADDRESS_2   0x3C
 
#define KNOB_REG_I2C_BUS_SUBADDRESS_3   0x3D
 
#define KNOB_REG_ALL_CALL_I2C_BUS_ADDRESS   0x3E
 
#define KNOB_REG_BRIGHTNESS_CONTROL_FOR_ALL_LED   0x3F
 
#define KNOB_REG_GAIN_CONTROL_FOR_ALL_LED   0x40
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_0   0x41
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_1   0x42
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_2   0x43
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_3   0x44
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_4   0x45
 
#define KNOB_REG_OUTPUT_ERROR_FLAG_5   0x46
 
#define KNOB_M1_AUTO_INCREMENT_BIT_1_TO_0   0x00
 
#define KNOB_M1_AUTO_INCREMENT_BIT_1_TO_1   0x40
 
#define KNOB_M1_AUTO_INCREMENT_BIT_0_TO_0   0x00
 
#define KNOB_M1_AUTO_INCREMENT_BIT_0_TO_1   0x20
 
#define KNOB_M1_SET_NORMAL_MODE   0x00
 
#define KNOB_M1_SET_LOW_POWER_MODE   0x10
 
#define KNOB_M1_USES_I2C_BUS_SUBADDRESS_1   0x08
 
#define KNOB_M1_USES_I2C_BUS_SUBADDRESS_2   0x04
 
#define KNOB_M1_USES_I2C_BUS_SUBADDRESS_3   0x02
 
#define KNOB_M1_USES_ALL_CALL_I2C_BUS_ADDRESS   0x01
 
#define KNOB_M2_GROUP_CONTROL_DIMMING   0x00
 
#define KNOB_M2_GROUP_CONTROL_BLINKING   0x20
 
#define KNOB_M2_CHANGE_ON_STOP_CMD   0x00
 
#define KNOB_M2_CHANGE_ON_ACK   0x10
 
#define KNOB_BRIGHTNESS_ALL_LED   0x30
 
#define KNOB_OUTPUT_GAIN_ALL_LED   0x40
 
#define KNOB_LED_ON   0xFF
 
#define KNOB_LED_OFF   0x00
 
#define KNOB_DEF_SLAVE_ADDRESS   0x70
 
#define KNOB_FULL_OUTPUT_CURRENT_GAIN   0xFF
 
#define KNOB_ENABLE_LED_OUTPUTS   0x00
 
#define KNOB_DISABLE_LED_OUTPUTS   0x01
 

Functions

void knob_cfg_setup (knob_cfg_t *cfg)
 Config Object Initialization function.
 
KNOB_RETVAL knob_init (knob_t *ctx, knob_cfg_t *cfg)
 Initialization function.
 
void knob_default_cfg (knob_t *ctx)
 Click Default Configuration function.
 
void knob_generic_write (knob_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void knob_generic_read (knob_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void knob_reset (knob_t *ctx)
 Functions for reset device.
 
void knob_led_output_enable (knob_t *ctx, uint8_t state)
 Functions for enable Led Output.
 
uint8_t knob_get_ena_state (knob_t *ctx)
 Functions for get ENA pin state.
 
uint8_t knob_get_enb_state (knob_t *ctx)
 Functions for get ENB pin state.
 
uint8_t knob_get_sw_button_state (knob_t *ctx)
 Functions for get SW pin(switch button) state.
 
void knob_set_encoder_start_position (knob_t *ctx, int32_t position)
 Functions for set new start encoder position.
 
void knob_set_led_state (knob_t *ctx, uint8_t led, uint8_t state)
 Functions for set led state(PWM on the LED)
 
void knob_set_brightness (knob_t *ctx, uint8_t led, uint8_t value)
 Functions for set Brightness.
 
void knob_set_output_gain (knob_t *ctx, uint8_t led, uint8_t value)
 Functions for set output GAIN.
 
void knob_get_encoder_position (knob_t *ctx, int32_t *position, uint8_t *dir)
 Functions for get Encoder position.
 

Detailed Description

This file contains API for Knob Click driver.