42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define CLOCKGEN3_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
77#define CLOCKGEN3_ERROR -1
84#define CLOCKGEN3_OCT_0 0
85#define CLOCKGEN3_OCT_1 1
86#define CLOCKGEN3_OCT_2 2
87#define CLOCKGEN3_OCT_3 3
88#define CLOCKGEN3_OCT_4 4
89#define CLOCKGEN3_OCT_5 5
90#define CLOCKGEN3_OCT_6 6
91#define CLOCKGEN3_OCT_7 7
92#define CLOCKGEN3_OCT_8 8
93#define CLOCKGEN3_OCT_9 9
94#define CLOCKGEN3_OCT_10 10
95#define CLOCKGEN3_OCT_11 11
96#define CLOCKGEN3_OCT_12 12
97#define CLOCKGEN3_OCT_13 13
98#define CLOCKGEN3_OCT_14 14
99#define CLOCKGEN3_OCT_15 15
106#define CLOCKGEN3_SLAVE_ADDRESS_GND 0x17
107#define CLOCKGEN3_SLAVE_ADDRESS_VCC 0x16
114#define CLOCKGEN3_CFG_ON_CLK_180 0x00
115#define CLOCKGEN3_CFG_OFF_ON 0x01
116#define CLOCKGEN3_CFG_ON_OFF 0x02
117#define CLOCKGEN3_CFG_POWER_DOWN 0x03
err_t clockgen3_init(clockgen3_t *ctx, clockgen3_cfg_t *cfg)
Initialization function.
void clockgen3_config(clockgen3_t *ctx, uint8_t cfg)
Configuration.
void clockgen3_generic_write(clockgen3_t *ctx, uint8_t *data_buf, uint8_t len)
Generic write function.
void clockgen3_set_freq(clockgen3_t *ctx, float freq)
Sets Frequency.
void clockgen3_generic_read(clockgen3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void clockgen3_cfg_setup(clockgen3_cfg_t *cfg)
Config Object Initialization function.
void clockgen3_set_cs_pin(clockgen3_t *ctx, uint8_t state)
Sets CS pin state.
Click configuration structure definition.
Definition clockgen3.h:149
uint32_t i2c_speed
Definition clockgen3.h:158
pin_name_t scl
Definition clockgen3.h:151
pin_name_t sda
Definition clockgen3.h:152
pin_name_t cs
Definition clockgen3.h:155
uint8_t i2c_address
Definition clockgen3.h:159
Click ctx object definition.
Definition clockgen3.h:131
digital_out_t cs
Definition clockgen3.h:133
i2c_master_t i2c
Definition clockgen3.h:136
uint8_t dev_config
Definition clockgen3.h:141
uint8_t slave_address
Definition clockgen3.h:139