NANO100_BSP V3.04.002
The Board Support Package for Nano100BN Series
NuEdu-Basic01_ClkOut.c
Go to the documentation of this file.
1/**************************************************************************/
12#include <stdio.h>
13#include "Nano100Series.h"
15
16
44void Open_CLK_OUT(uint32_t Clock_Source, uint32_t FRQDIV_FSEL)
45{
46
47 //Initial FCLKO Function Pin
48 SYS->PB_H_MFP = (SYS->PB_H_MFP & ~SYS_PB_H_MFP_PB12_MFP_Msk) | SYS_PB_H_MFP_PB12_MFP_CKO;
49
50 if(FRQDIV_FSEL>15)
51 {
52 printf("\nOpen CLK OUT FAIL\n");
53 return;
54 }
55
56 //Initial FCLKO Clock Divider
57 CLK->FRQDIV = CLK_FRQDIV_FDIV_EN_Msk | FRQDIV_FSEL;
58
59 /* Select FCLKO clock source */
60 CLK->CLKSEL2 = (CLK->CLKSEL2 & (~CLK_CLKSEL2_FRQDIV_S_Msk)) | Clock_Source;
61
62 /* Enable FCLKO clock source */
63 CLK->APBCLK |= CLK_APBCLK_FDIV_EN_Msk;
64
66
67}
68
73void Close_CLK_OUT(void)
74{
75
76 //Disable FCLKO Function
77 CLK->FRQDIV &= ~CLK_FRQDIV_FDIV_EN_Msk;
78
79 //Disable FCLKO Clock Source
81 CLK->APBCLK &= ~CLK_APBCLK_FDIV_EN_Msk;
83}
84
85 /* end of group Nano130_Basic01_FUNCTIONS ClkOut Exported Functions */
87 /* end of group NuEdu-SDK-Nano130_Basic01 Nano130_Basic01 Library */
89 /* end of group NANO100_Library NANO100 Library */
91
92/*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
NuEdu-Basic01 ClkOut driver header file.
#define CLK_APBCLK_FDIV_EN_Msk
#define CLK_FRQDIV_FDIV_EN_Msk
#define CLK
Pointer to CLK register structure.
#define SYS
Pointer to SYS register structure.
#define SYS_PB_H_MFP_PB12_MFP_CKO
Definition: sys.h:287
__STATIC_INLINE void SYS_LockReg(void)
Enable register write-protection function.
Definition: sys.h:843
__STATIC_INLINE void SYS_UnlockReg(void)
Disable register write-protection function.
Definition: sys.h:826
void Close_CLK_OUT(void)
This function disable frequency output function.
void Open_CLK_OUT(uint32_t Clock_Source, uint32_t FRQDIV_FSEL)
This function enable frequency divider module clock, enable frequency divider clock function and conf...