clockgen4 2.0.0.0
Clock Gen 4 Click Driver

API for configuring and manipulating Clock Gen 4 Click driver. More...

Topics

 Clock Gen 4 Registers List
 List of registers of Clock Gen 4 Click driver.
 
 Clock Gen 4 Registers Settings
 Settings for registers of Clock Gen 4 Click driver.
 
 Clock Gen 4 MikroBUS Map
 MikroBUS pin mapping of Clock Gen 4 Click driver.
 

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

API for configuring and manipulating Clock Gen 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ clockgen4_cfg_setup()

void clockgen4_cfg_setup ( clockgen4_cfg_t * cfg)

Clock Gen 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See clockgen4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ clockgen4_default_cfg()

err_t clockgen4_default_cfg ( clockgen4_t * ctx)

Clock Gen 4 default configuration function.

This function executes a default configuration of Clock Gen 4 click board.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ clockgen4_dev_cfg()

void clockgen4_dev_cfg ( clockgen4_t * ctx,
uint8_t dev_cfg )

Clock Gen 4 device configuration function.

Function is used to write to device configuration 1 register in order to apply settings.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]dev_cfg: 8-bit input data.
Returns
Nothing.
Note
Settings available : R-Mod Selection, Auxiliary Output Source Selection. Enable Device Configuration Registers 1.

◆ clockgen4_dev_ctl()

void clockgen4_dev_ctl ( clockgen4_t * ctx,
uint8_t dev_ctl )

Clock Gen 4 device control function.

Function is used to write to device control register in order to apply settings.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]dev_ctl: 8-bit input data.
Returns
Nothing.
Note
Settings available : Unlock Indicator(Read Only), Auxiliary Output Disable. PLL Clock Output Disable.

◆ clockgen4_drv_interface_selection()

void clockgen4_drv_interface_selection ( clockgen4_cfg_t * cfg,
clockgen4_drv_t drv_sel )

Clock Gen 4 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See clockgen4_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See clockgen4_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ clockgen4_fnc_cfg_1()

void clockgen4_fnc_cfg_1 ( clockgen4_t * ctx,
uint8_t fnc_cfg )

Clock Gen 4 configuration 1 function.

Function is used to write to function configuration 1 register in order to apply settings.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]fnc_cfg: 8-bit input data.
Returns
Nothing.
Note
Settings available : AUX PLL Lock Output Configuration, Reference Clock Input Divider.

◆ clockgen4_fnc_cfg_2()

void clockgen4_fnc_cfg_2 ( clockgen4_t * ctx,
uint8_t fnc_cfg )

Clock Gen 4 configuration 2 function.

Function is used to write to function configuration 2 register in order to apply settings.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]fnc_cfg: 8-bit input data.
Returns
Nothing.
Note
Settings available : Enable PLL Clock Output on Unlock.

◆ clockgen4_generic_read()

err_t clockgen4_generic_read ( clockgen4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Clock Gen 4 data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ clockgen4_generic_write()

err_t clockgen4_generic_write ( clockgen4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Clock Gen 4 data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ clockgen4_glob_cfg()

void clockgen4_glob_cfg ( clockgen4_t * ctx,
uint8_t glob_cfg )

Clock Gen 4 global configuration function.

Function is used to write to function configuration 2 register in order to apply settings.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]glob_cfg: 8-bit input data.
Returns
Nothing.
Note
Settings available : Device Configuration Freeze, Enable Device Configuration Registers 2.

◆ clockgen4_init()

err_t clockgen4_init ( clockgen4_t * ctx,
clockgen4_cfg_t * cfg )

Clock Gen 4 initialization function.

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

Parameters
[out]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See clockgen4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ clockgen4_set_ratio()

uint32_t clockgen4_set_ratio ( clockgen4_t * ctx,
float ratio )

Clock Gen 4 set ratio function.

Function is used to set the ratio between the output signal and the input clock.

Parameters
[in]ctx: Click context object. See clockgen4_t object definition for detailed explanation.
[in]ratio:float value that represents the ratio between the output signal and the input clock.
Returns
sdr : 32-bit calculated input data.
Note
To calculate the Ratio to store in the register(s), divide the desired output clock frequency by the given input clock.