V2.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* File Name : ch32v20x_it.c
|
||||
* Author : WCH
|
||||
* Version : V1.0.0
|
||||
* Date : 2021/06/06
|
||||
* Date : 2023/12/29
|
||||
* Description : Main Interrupt Service Routines.
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
@@ -24,6 +24,9 @@ void I2C1_ER_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
@@ -79,7 +79,7 @@ void IIC_Init(u32 bound, u16 address)
|
||||
|
||||
#if(I2C_MODE == SLAVE_MODE)
|
||||
NVIC_InitStructure.NVIC_IRQChannel = I2C1_ER_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
@@ -90,11 +90,6 @@ void IIC_Init(u32 bound, u16 address)
|
||||
|
||||
I2C_Cmd(I2C1, ENABLE);
|
||||
I2C_CalculatePEC(I2C1, ENABLE);
|
||||
|
||||
#if(I2C_MODE == HOST_MODE)
|
||||
I2C_AcknowledgeConfig(I2C1, ENABLE);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
@@ -109,7 +104,7 @@ int main(void)
|
||||
u8 i = 0;
|
||||
u8 pecValue;
|
||||
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
|
||||
SystemCoreClockUpdate();
|
||||
Delay_Init();
|
||||
USART_Printf_Init(460800);
|
||||
|
||||
@@ -111,10 +111,10 @@ static void SetSysClockTo144_HSI( void );
|
||||
void SystemInit (void)
|
||||
{
|
||||
RCC->CTLR |= (uint32_t)0x00000001;
|
||||
RCC->CFGR0 &= (uint32_t)0xF8FF0000;
|
||||
RCC->CFGR0 &= (uint32_t)0xF0FF0000;
|
||||
RCC->CTLR &= (uint32_t)0xFEF6FFFF;
|
||||
RCC->CTLR &= (uint32_t)0xFFFBFFFF;
|
||||
RCC->CFGR0 &= (uint32_t)0xFF80FFFF;
|
||||
RCC->CFGR0 &= (uint32_t)0xFF00FFFF;
|
||||
RCC->INTR = 0x009F0000;
|
||||
SetSysClock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user