pll 2.0.0.0
pll.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef PLL_H
36#define PLL_H
37
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54
55// -------------------------------------------------------------- PUBLIC MACROS
65#define PLL_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.s0 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
68 cfg.oe = MIKROBUS( mikrobus, MIKROBUS_CS );
75#define PLL_OK 0
76#define PLL_ERROR -1
83#define PLL_CLOCK_ENABLE 0x01
84#define PLL_CLOCK_DISABLE 0x00
87 // End group macro
88// --------------------------------------------------------------- PUBLIC TYPES
97typedef struct
98{
99 // Input/Output pins
100 pin_name_t s1;
101 pin_name_t s0;
102
103 // Output pins
104 digital_out_t oe;
105
106} pll_t;
107
111typedef struct
112{
113 // Additional gpio pins
114 pin_name_t s1;
115 pin_name_t s0;
116 pin_name_t oe;
117
118} pll_cfg_t;
119
120 // End types group
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
149err_t pll_init ( pll_t *ctx, pll_cfg_t *cfg );
150
162void pll_set_clock_output ( pll_t *ctx, uint8_t mode );
163
172void pll_set_pll_4x ( pll_t *ctx );
173
182void pll_set_pll_5x ( pll_t *ctx );
183
192void pll_set_pll_6x ( pll_t *ctx );
193
202void pll_set_pll_8x ( pll_t *ctx );
203
212void pll_set_pll_2x ( pll_t *ctx );
213
222void pll_set_pll_3x ( pll_t *ctx );
223
233
243
253
254#ifdef __cplusplus
255}
256#endif
257#endif // _PLL_H_
258
259 // End public_function group
261
262// ------------------------------------------------------------------------- END
void pll_set_pll_5_3125x(pll_t *ctx)
Functions for settings PLL clock x5.3125.
void pll_set_pll_3x(pll_t *ctx)
Functions for settings PLL x3.
void pll_set_pll_6x(pll_t *ctx)
Functions for settings PLL x6.
err_t pll_init(pll_t *ctx, pll_cfg_t *cfg)
Initialization function.
void pll_set_pll_2x(pll_t *ctx)
Functions for settings PLL x2.
void pll_set_pll_6_25x(pll_t *ctx)
Functions for settings PLL clock x6.25.
void pll_set_clock_output(pll_t *ctx, uint8_t mode)
Functions for settings clock output.
void pll_set_pll_8x(pll_t *ctx)
Functions for settings PLL x6.
void pll_set_pll_3_125x(pll_t *ctx)
Functions for settings PLL clock x3.125.
void pll_set_pll_4x(pll_t *ctx)
Functions for settings PLL x4.
void pll_set_pll_5x(pll_t *ctx)
Functions for settings PLL x5.
void pll_cfg_setup(pll_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition pll.h:112
pin_name_t s0
Definition pll.h:115
pin_name_t oe
Definition pll.h:116
pin_name_t s1
Definition pll.h:114
Click ctx object definition.
Definition pll.h:98
pin_name_t s0
Definition pll.h:101
pin_name_t s1
Definition pll.h:100
digital_out_t oe
Definition pll.h:104