/********************************** (C) COPYRIGHT ******************************* * File Name : main.c * Author : WCH * Version : V1.0 * Date : 2020/08/06 * Description : Direct test mode ********************************************************************************* * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Attention: This software (modified or not) and binary are used for * microcontroller manufactured by Nanjing Qinheng Microelectronics. *******************************************************************************/ /******************************************************************************/ /* Header file contains */ #include "debug.h" #include "CONFIG.h" #include "HAL.h" #include "test_dtm.h" #include "uart.h" #include "ch32v20x_usbfs_device.h" /********************************************************************* * GLOBAL TYPEDEFS */ __attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4]; #if(defined(BLE_MAC)) && (BLE_MAC == TRUE) const uint8_t MacAddr[6] = {0x84, 0xC2, 0xE4, 0x03, 0x02, 0x02}; #endif /********************************************************************* * @fn Main_Circulation * * @brief Main loop * * @return none */ __attribute__((section(".highcode"))) __attribute__((noinline)) void Main_Circulation(void) { while(1) { TMOS_SystemProcess(); } } /********************************************************************* * @fn main * * @brief Main function * * @return none */ int main(void) { SystemCoreClockUpdate(); Delay_Init(); #ifdef DEBUG // 默认Uart1打印 Uart2 Test USART_Printf_Init( 115200 ); #endif PRINT("%s\n", VER_LIB); WCHBLE_Init(); HAL_Init(); uart_task_init(); #if USB_UartEnable == 1 // 默认使能USB模拟串口 /* Usb Init */ USBFS_RCC_Init(); USBFS_Device_Init( ENABLE ); USB_Task_Init(); #endif test_dtm_init(); GAPRole_BroadcasterInit(); Main_Circulation(); } /******************************** endfile @ main ******************************/