clockgen4 2.0.0.0
clockgen4.h File Reference

This file contains API for Clock Gen 4 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  clockgen4_s
 Clock Gen 4 Click context object. More...
 
struct  clockgen4_cfg_t
 Clock Gen 4 Click configuration object. More...
 

Macros

#define CLOCKGEN4_REG_DEV_ID   0x01
 Clock Gen 4 description register.
 
#define CLOCKGEN4_REG_DEV_CTL   0x02
 
#define CLOCKGEN4_REG_DEV_CFG_1   0x03
 
#define CLOCKGEN4_REG_GLOB_CFG   0x05
 
#define CLOCKGEN4_REG_M_MSB   0x06
 
#define CLOCKGEN4_REG_L_MSB   0x07
 
#define CLOCKGEN4_REG_M_LSB   0x08
 
#define CLOCKGEN4_REG_L_LSB   0x09
 
#define CLOCKGEN4_REG_FNC_CFG_1   0x16
 
#define CLOCKGEN4_REG_FNC_CFG_2   0x17
 
#define CLOCKGEN4_INCR_ENABLE   0x80
 Clock Gen 4 description setting.
 
#define CLOCKGEN4_INCR_DISABLE   0x00
 
#define CLOCKGEN4_PLL_UNLOCKED   0x00
 Clock Gen 4 device control.
 
#define CLOCKGEN4_PLL_LOCKED   0x80
 
#define CLOCKGEN4_AUX_OUT_EN   0x00
 
#define CLOCKGEN4_AUX_OUT_DIS   0x02
 
#define CLOCKGEN4_CLK_OUT_EN   0x00
 
#define CLOCKGEN4_CLK_OUT_DIS   0x01
 
#define CLOCKGEN4_R_MOD_SEL_L_0   0x00
 Clock Gen 4 device configuration 1.
 
#define CLOCKGEN4_R_MOD_SEL_L_1   0x20
 
#define CLOCKGEN4_R_MOD_SEL_L_2   0x40
 
#define CLOCKGEN4_R_MOD_SEL_L_3   0x60
 
#define CLOCKGEN4_R_MOD_SEL_R_1   0x80
 
#define CLOCKGEN4_R_MOD_SEL_R_2   0xA0
 
#define CLOCKGEN4_R_MOD_SEL_R_3   0xC0
 
#define CLOCKGEN4_R_MOD_SEL_R_4   0xE0
 
#define CLOCKGEN4_REG_CLK   0x00
 
#define CLOCKGEN4_CLK_OUT   0x04
 
#define CLOCKGEN4_PLL_STAT_IND   0x06
 
#define CLOCKGEN4_DEV_CFG_1_EN   0x01
 
#define CLOCKGEN4_DEV_CFG_1_DIS   0x00
 
#define CLOCKGEN4_DEV_CFG_FRZ   0x00
 Clock Gen 4 global configuration.
 
#define CLOCKGEN4_DEV_CFG_UNFRZ   0x08
 
#define CLOCKGEN4_DEV_CFG_2_EN   0x01
 
#define CLOCKGEN4_DEV_CFG_2_DIS   0x00
 
#define CLOCKGEN4_AUX_OUT_ACT_H   0x00
 Clock Gen 4 function configuration 1.
 
#define CLOCKGEN4_AUX_OUT_ACT_L   0x40
 
#define CLOCKGEN4_REF_CLK_DIV_4   0x00
 
#define CLOCKGEN4_REF_CLK_DIV_2   0x08
 
#define CLOCKGEN4_REF_CLK_DIV_1   0x10
 
#define CLOCKGEN4_CLK_OUT_UNL_L   0x00
 Clock Gen 4 function configuration 2.
 
#define CLOCKGEN4_CLK_OUT_UNL_U   0x10
 
#define CLOCKGEN4_REF_CLK_25_MHZ   25.0
 Clock Gen 4 input clock.
 
#define CLOCKGEN4_I2C_ADR_GND   0x4E
 Clock Gen 4 device address setting.
 
#define CLOCKGEN4_I2C_ADR_VCC   0x4F
 
#define CLOCKGEN4_SPI_CHIP_ADR   0x9E
 
#define CLOCKGEN4_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define CLOCKGEN4_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define CLOCKGEN4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* clockgen4_master_io_t) (struct clockgen4_s *, uint8_t, uint8_t *, uint8_t)
 Clock Gen 4 Click driver interface.
 
typedef struct clockgen4_s clockgen4_t
 Clock Gen 4 Click context object.
 

Enumerations

enum  clockgen4_drv_t { CLOCKGEN4_DRV_SEL_SPI , CLOCKGEN4_DRV_SEL_I2C }
 Clock Gen 4 Click driver selector. More...
 
enum  clockgen4_return_value_t { CLOCKGEN4_OK = 0 , CLOCKGEN4_ERROR = -1 }
 Clock Gen 4 Click return value data. More...
 

Functions

void clockgen4_cfg_setup (clockgen4_cfg_t *cfg)
 Clock Gen 4 configuration object setup function.
 
void clockgen4_drv_interface_selection (clockgen4_cfg_t *cfg, clockgen4_drv_t drv_sel)
 Clock Gen 4 driver interface setup function.
 
err_t clockgen4_init (clockgen4_t *ctx, clockgen4_cfg_t *cfg)
 Clock Gen 4 initialization function.
 
err_t clockgen4_default_cfg (clockgen4_t *ctx)
 Clock Gen 4 default configuration function.
 
err_t clockgen4_generic_write (clockgen4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Clock Gen 4 data writing function.
 
err_t clockgen4_generic_read (clockgen4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Clock Gen 4 data reading function.
 
void clockgen4_dev_ctl (clockgen4_t *ctx, uint8_t dev_ctl)
 Clock Gen 4 device control function.
 
void clockgen4_dev_cfg (clockgen4_t *ctx, uint8_t dev_cfg)
 Clock Gen 4 device configuration function.
 
void clockgen4_glob_cfg (clockgen4_t *ctx, uint8_t glob_cfg)
 Clock Gen 4 global configuration function.
 
void clockgen4_fnc_cfg_1 (clockgen4_t *ctx, uint8_t fnc_cfg)
 Clock Gen 4 configuration 1 function.
 
void clockgen4_fnc_cfg_2 (clockgen4_t *ctx, uint8_t fnc_cfg)
 Clock Gen 4 configuration 2 function.
 
uint32_t clockgen4_set_ratio (clockgen4_t *ctx, float ratio)
 Clock Gen 4 set ratio function.
 

Detailed Description

This file contains API for Clock Gen 4 Click Driver.

Typedef Documentation

◆ clockgen4_master_io_t

typedef err_t(* clockgen4_master_io_t) (struct clockgen4_s *, uint8_t, uint8_t *, uint8_t)

Clock Gen 4 Click driver interface.

Definition of driver interface of Clock Gen 4 Click driver. Driver serial interface.

◆ clockgen4_t

typedef struct clockgen4_s clockgen4_t

Clock Gen 4 Click context object.

Context object definition of Clock Gen 4 Click driver.

Enumeration Type Documentation

◆ clockgen4_drv_t

Clock Gen 4 Click driver selector.

Selects target driver interface of Clock Gen 4 Click driver.

Enumerator
CLOCKGEN4_DRV_SEL_SPI 

SPI driver descriptor.

CLOCKGEN4_DRV_SEL_I2C 

I2C driver descriptor.

◆ clockgen4_return_value_t

Clock Gen 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
CLOCKGEN4_OK 
CLOCKGEN4_ERROR