forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcuconf.h
70 lines (53 loc) · 1.64 KB
/
mcuconf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include "nvic.h"
#define HT32F52342_MCUCONF
/*
* HAL driver system settings.
*/
/*
* Clock configuration.
*/
// This configuration:
// 8 MHz HSE crystal
// PLL multiplies HSE to 48 MHz core and peripheral clock
// 48 MHz to UART
// 48 MHz to USB
#define HT32_CK_HSE_FREQUENCY 8000000UL // 8 MHz
#define HT32_CKCU_SW CKCU_GCCR_SW_PLL
#define HT32_PLL_USE_HSE TRUE
#define HT32_PLL_FBDIV 6 // 8 MHz -> 48 MHz
#define HT32_PLL_OTDIV 0
#define HT32_AHB_PRESCALER 1 // 48 MHz -> 48 MHz
#define HT32_USART_PRESCALER 1 // 48 MHz
#define HT32_USB_PRESCALER 1 // 48 MHz -> 48 MHz
// SysTick uses processor clock at 48MHz
#define HT32_ST_USE_HCLK TRUE
/*
* Peripheral driver settings
*/
#define HT32_SERIAL_USE_USART0 TRUE
#define HT32_USART0_IRQ_PRIORITY 6
#define HT32_SERIAL_USE_USART1 TRUE
#define HT32_USART1_IRQ_PRIORITY 7
/*
* USB driver settings
*/
#define HT32_USB_USE_USB0 TRUE
#define HT32_USB_USB0_IRQ_PRIORITY 5
/*
* SPI driver setting
*/
#define HT32_SPI_USE_SPI1 TRUE
#define HT32_SPI1_IRQ_PRIORITY 9