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 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define PLL_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
53  cfg.s0 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
54  cfg.oe = MIKROBUS( mikrobus, MIKROBUS_CS );
55 
61 #define PLL_OK 0
62 #define PLL_ERROR -1
63 
69 #define PLL_CLOCK_ENABLE 0x01
70 #define PLL_CLOCK_DISABLE 0x00
71  // End group macro
74 // --------------------------------------------------------------- PUBLIC TYPES
83 typedef struct
84 {
85  // Input/Output pins
86  pin_name_t s1;
87  pin_name_t s0;
88 
89  // Output pins
90  digital_out_t oe;
91 
92 } pll_t;
93 
97 typedef struct
98 {
99  // Additional gpio pins
100  pin_name_t s1;
101  pin_name_t s0;
102  pin_name_t oe;
103 
104 } pll_cfg_t;
105  // End types group
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
126 void pll_cfg_setup ( pll_cfg_t *cfg );
127 
135 err_t pll_init ( pll_t *ctx, pll_cfg_t *cfg );
136 
148 void pll_set_clock_output ( pll_t *ctx, uint8_t mode );
149 
158 void pll_set_pll_4x ( pll_t *ctx );
159 
168 void pll_set_pll_5x ( pll_t *ctx );
169 
178 void pll_set_pll_6x ( pll_t *ctx );
179 
188 void pll_set_pll_8x ( pll_t *ctx );
189 
198 void pll_set_pll_2x ( pll_t *ctx );
199 
208 void pll_set_pll_3x ( pll_t *ctx );
209 
218 void pll_set_pll_3_125x ( pll_t *ctx );
219 
228 void pll_set_pll_6_25x ( pll_t *ctx );
229 
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 #endif // _PLL_H_
244  // End public_function group
247 
248 // ------------------------------------------------------------------------- END
pll_set_pll_4x
void pll_set_pll_4x(pll_t *ctx)
Functions for settings PLL x4.
pll_set_pll_5_3125x
void pll_set_pll_5_3125x(pll_t *ctx)
Functions for settings PLL clock x5.3125.
pll_cfg_t::oe
pin_name_t oe
Definition: pll.h:102
pll_t::s1
pin_name_t s1
Definition: pll.h:86
pll_set_pll_6_25x
void pll_set_pll_6_25x(pll_t *ctx)
Functions for settings PLL clock x6.25.
pll_set_pll_8x
void pll_set_pll_8x(pll_t *ctx)
Functions for settings PLL x6.
pll_set_pll_2x
void pll_set_pll_2x(pll_t *ctx)
Functions for settings PLL x2.
pll_set_clock_output
void pll_set_clock_output(pll_t *ctx, uint8_t mode)
Functions for settings clock output.
pll_set_pll_5x
void pll_set_pll_5x(pll_t *ctx)
Functions for settings PLL x5.
pll_cfg_t
Click configuration structure definition.
Definition: pll.h:98
pll_t::oe
digital_out_t oe
Definition: pll.h:90
pll_set_pll_3_125x
void pll_set_pll_3_125x(pll_t *ctx)
Functions for settings PLL clock x3.125.
pll_init
err_t pll_init(pll_t *ctx, pll_cfg_t *cfg)
Initialization function.
pll_t
Click ctx object definition.
Definition: pll.h:84
pll_cfg_t::s0
pin_name_t s0
Definition: pll.h:101
pll_set_pll_3x
void pll_set_pll_3x(pll_t *ctx)
Functions for settings PLL x3.
pll_t::s0
pin_name_t s0
Definition: pll.h:87
pll_set_pll_6x
void pll_set_pll_6x(pll_t *ctx)
Functions for settings PLL x6.
pll_cfg_setup
void pll_cfg_setup(pll_cfg_t *cfg)
Config Object Initialization function.
pll_cfg_t::s1
pin_name_t s1
Definition: pll.h:100