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  cfg.ick= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56 
62 #define PLL_RETVAL uint8_t
63 
64 #define PLL_OK 0x00
65 #define PLL_INIT_ERROR 0xFF
66 
72 #define PLL_CLOCK_ENABLE 0x01
73 #define PLL_CLOCK_DISABLE 0x00
74  // End group macro
77 // --------------------------------------------------------------- PUBLIC TYPES
86 typedef struct
87 {
88  // Output pins
89 
90  digital_out_t s1;
91  digital_out_t s0;
92  digital_out_t oe;
93 
94  // Input pins
95 
96  digital_in_t ick;
97 
98 } pll_t;
99 
103 typedef struct
104 {
105  // Additional gpio pins
106 
107  pin_name_t s1;
108  pin_name_t s0;
109  pin_name_t oe;
110  pin_name_t ick;
111 
112 } pll_cfg_t;
113  // End types group
115 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
116 
122 #ifdef __cplusplus
123 extern "C"{
124 #endif
125 
134 void pll_cfg_setup ( pll_cfg_t *cfg );
135 
143 PLL_RETVAL pll_init ( pll_t *ctx, pll_cfg_t *cfg );
144 
156 void pll_set_clock_output ( pll_t *ctx, uint8_t mode );
157 
166 void pll_set_pll_4x ( pll_t *ctx );
167 
176 void pll_set_pll_5x ( pll_t *ctx );
177 
186 void pll_set_pll_6x ( pll_t *ctx );
187 
196 void pll_set_pll_8x ( pll_t *ctx );
197 
206 void pll_set_pll_3x ( pll_t *ctx );
207 
216 void pll_set_pll_3_125x ( pll_t *ctx );
217 
226 void pll_set_pll_6_25x ( pll_t *ctx );
227 
236 void pll_set_pll_5_3125x ( pll_t *ctx );
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 #endif // _PLL_H_
242  // End public_function group
245 
246 // ------------------------------------------------------------------------- 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:109
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_RETVAL
#define PLL_RETVAL
Definition: pll.h:62
pll_set_clock_output
void pll_set_clock_output(pll_t *ctx, uint8_t mode)
Functions for settings clock output.
pll_t::s0
digital_out_t s0
Definition: pll.h:91
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:103
pll_t::s1
digital_out_t s1
Definition: pll.h:90
pll_t::ick
digital_in_t ick
Definition: pll.h:96
pll_t::oe
digital_out_t oe
Definition: pll.h:92
pll_set_pll_3_125x
void pll_set_pll_3_125x(pll_t *ctx)
Functions for settings PLL clock x3.125.
pll_cfg_t::ick
pin_name_t ick
Definition: pll.h:110
pll_init
PLL_RETVAL pll_init(pll_t *ctx, pll_cfg_t *cfg)
Initialization function.
pll_t
Click ctx object definition.
Definition: pll.h:86
pll_cfg_t::s0
pin_name_t s0
Definition: pll.h:108
pll_set_pll_3x
void pll_set_pll_3x(pll_t *ctx)
Functions for settings PLL x3.
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:107