Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
38 #include "drv_spi_master.h"
61 #define CLOCKGEN4_REG_DEV_ID 0x01
62 #define CLOCKGEN4_REG_DEV_CTL 0x02
63 #define CLOCKGEN4_REG_DEV_CFG_1 0x03
64 #define CLOCKGEN4_REG_GLOB_CFG 0x05
65 #define CLOCKGEN4_REG_M_MSB 0x06
66 #define CLOCKGEN4_REG_L_MSB 0x07
67 #define CLOCKGEN4_REG_M_LSB 0x08
68 #define CLOCKGEN4_REG_L_LSB 0x09
69 #define CLOCKGEN4_REG_FNC_CFG_1 0x16
70 #define CLOCKGEN4_REG_FNC_CFG_2 0x17
93 #define CLOCKGEN4_INCR_ENABLE 0x80
94 #define CLOCKGEN4_INCR_DISABLE 0x00
100 #define CLOCKGEN4_PLL_UNLOCKED 0x00
101 #define CLOCKGEN4_PLL_LOCKED 0x80
102 #define CLOCKGEN4_AUX_OUT_EN 0x00
103 #define CLOCKGEN4_AUX_OUT_DIS 0x02
104 #define CLOCKGEN4_CLK_OUT_EN 0x00
105 #define CLOCKGEN4_CLK_OUT_DIS 0x01
111 #define CLOCKGEN4_R_MOD_SEL_L_0 0x00
112 #define CLOCKGEN4_R_MOD_SEL_L_1 0x20
113 #define CLOCKGEN4_R_MOD_SEL_L_2 0x40
114 #define CLOCKGEN4_R_MOD_SEL_L_3 0x60
115 #define CLOCKGEN4_R_MOD_SEL_R_1 0x80
116 #define CLOCKGEN4_R_MOD_SEL_R_2 0xA0
117 #define CLOCKGEN4_R_MOD_SEL_R_3 0xC0
118 #define CLOCKGEN4_R_MOD_SEL_R_4 0xE0
119 #define CLOCKGEN4_REG_CLK 0x00
120 #define CLOCKGEN4_CLK_OUT 0x04
121 #define CLOCKGEN4_PLL_STAT_IND 0x06
122 #define CLOCKGEN4_DEV_CFG_1_EN 0x01
123 #define CLOCKGEN4_DEV_CFG_1_DIS 0x00
129 #define CLOCKGEN4_DEV_CFG_FRZ 0x00
130 #define CLOCKGEN4_DEV_CFG_UNFRZ 0x08
131 #define CLOCKGEN4_DEV_CFG_2_EN 0x01
132 #define CLOCKGEN4_DEV_CFG_2_DIS 0x00
138 #define CLOCKGEN4_AUX_OUT_ACT_H 0x00
139 #define CLOCKGEN4_AUX_OUT_ACT_L 0x40
140 #define CLOCKGEN4_REF_CLK_DIV_4 0x00
141 #define CLOCKGEN4_REF_CLK_DIV_2 0x08
142 #define CLOCKGEN4_REF_CLK_DIV_1 0x10
148 #define CLOCKGEN4_CLK_OUT_UNL_L 0x00
149 #define CLOCKGEN4_CLK_OUT_UNL_U 0x10
155 #define CLOCKGEN4_REF_CLK_25_MHZ 25.0
162 #define CLOCKGEN4_I2C_ADR_GND 0x4E
163 #define CLOCKGEN4_I2C_ADR_VCC 0x4F
165 #define CLOCKGEN4_SPI_CHIP_ADR 0x9E
174 #define CLOCKGEN4_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
175 #define CLOCKGEN4_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
192 #define CLOCKGEN4_MAP_MIKROBUS( cfg, mikrobus ) \
193 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
194 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
195 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
196 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
197 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
198 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
452 #endif // CLOCKGEN4_H
uint8_t slave_address
Definition: clockgen4.h:229
void clockgen4_fnc_cfg_1(clockgen4_t *ctx, uint8_t fnc_cfg)
Clock Gen 4 configuration 1 function.
uint32_t clockgen4_set_ratio(clockgen4_t *ctx, float ratio)
Clock Gen 4 set ratio function.
struct clockgen4_s clockgen4_t
Clock Gen 4 Click context object.
void clockgen4_cfg_setup(clockgen4_cfg_t *cfg)
Clock Gen 4 configuration object setup function.
Clock Gen 4 Click context object.
Definition: clockgen4.h:224
This file contains SPI specific macros, functions, etc.
Definition: clockgen4.h:209
pin_name_t scl
Definition: clockgen4.h:244
void clockgen4_drv_interface_selection(clockgen4_cfg_t *cfg, clockgen4_drv_t drv_sel)
Clock Gen 4 driver interface setup function.
clockgen4_drv_t
Clock Gen 4 Click driver selector.
Definition: clockgen4.h:207
clockgen4_drv_t drv_sel
Definition: clockgen4.h:258
spi_master_t spi
Definition: clockgen4.h:227
pin_name_t mosi
Definition: clockgen4.h:247
void clockgen4_dev_ctl(clockgen4_t *ctx, uint8_t dev_ctl)
Clock Gen 4 device control function.
clockgen4_master_io_t read_f
Definition: clockgen4.h:234
i2c_master_t i2c
Definition: clockgen4.h:226
spi_master_mode_t spi_mode
Definition: clockgen4.h:255
spi_master_chip_select_polarity_t cs_polarity
Definition: clockgen4.h:256
uint32_t i2c_speed
Definition: clockgen4.h:251
pin_name_t chip_select
Definition: clockgen4.h:230
pin_name_t cs
Definition: clockgen4.h:249
err_t clockgen4_init(clockgen4_t *ctx, clockgen4_cfg_t *cfg)
Clock Gen 4 initialization function.
uint8_t i2c_address
Definition: clockgen4.h:252
clockgen4_return_value_t
Clock Gen 4 Click return value data.
Definition: clockgen4.h:266
pin_name_t sda
Definition: clockgen4.h:245
Definition: clockgen4.h:268
Definition: clockgen4.h:210
void clockgen4_glob_cfg(clockgen4_t *ctx, uint8_t glob_cfg)
Clock Gen 4 global configuration 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_cfg(clockgen4_t *ctx, uint8_t dev_cfg)
Clock Gen 4 device configuration function.
pin_name_t sck
Definition: clockgen4.h:248
clockgen4_master_io_t write_f
Definition: clockgen4.h:233
uint32_t spi_speed
Definition: clockgen4.h:254
Definition: clockgen4.h:269
pin_name_t miso
Definition: clockgen4.h:246
err_t(* clockgen4_master_io_t)(struct clockgen4_s *, uint8_t, uint8_t *, uint8_t)
Clock Gen 4 Click driver interface.
Definition: clockgen4.h:218
err_t clockgen4_generic_write(clockgen4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Clock Gen 4 data writing function.
clockgen4_drv_t drv_sel
Definition: clockgen4.h:231
Clock Gen 4 Click configuration object.
Definition: clockgen4.h:242
err_t clockgen4_default_cfg(clockgen4_t *ctx)
Clock Gen 4 default configuration function.
void clockgen4_fnc_cfg_2(clockgen4_t *ctx, uint8_t fnc_cfg)
Clock Gen 4 configuration 2 function.