BLE_TYQ_BJQ_CH584M/APP/multiCentral_main.c

107 lines
2.8 KiB
C
Raw Normal View History

2024-12-07 17:09:36 +08:00
/*
* @Author: mbw
* @Date: 2024-12-03 11:13:13
* @LastEditors: mbw && 1600520629@qq.com
2024-12-11 20:03:50 +08:00
* @LastEditTime: 2024-12-09 13:34:51
2024-12-07 17:09:36 +08:00
* @FilePath: \ble_-tyq_-bjq_-ch584-m\APP\multiCentral_main.c
* @Description:
*
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
*/
2024-12-03 11:11:30 +08:00
/********************************** (C) COPYRIGHT *******************************
* File Name : main.c
* Author : WCH
* Version : V1.0
* Date : 2020/08/06
* Description :
*********************************************************************************
* 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.
*******************************************************************************/
/******************************************************************************/
#include "CONFIG.h"
#include "HAL.h"
#include "multiCentral.h"
2024-12-07 17:09:36 +08:00
#include "bsp_uart.h"
#include "log.h"
2024-12-11 20:03:50 +08:00
#include "bsp_flash.h"
2024-12-07 17:09:36 +08:00
#undef LOG_ENABLE
#define LOG_ENABLE 1
2024-12-03 11:11:30 +08:00
/*********************************************************************
* 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
*
2024-12-07 17:09:36 +08:00
* @brief
2024-12-03 11:11:30 +08:00
*
* @return none
*/
__HIGH_CODE
__attribute__((noinline))
void Main_Circulation()
{
while(1)
{
TMOS_SystemProcess();
}
}
/*********************************************************************
* @fn main
*
2024-12-07 17:09:36 +08:00
* @brief
2024-12-03 11:11:30 +08:00
*
* @return none
*/
int main(void)
{
#if(defined(DCDC_ENABLE)) && (DCDC_ENABLE == TRUE)
PWR_DCDCCfg(ENABLE);
#endif
HSECFG_Capacitance(HSECap_18p);
SetSysClock(CLK_SOURCE_HSE_PLL_62_4MHz);
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
#endif
2024-12-07 17:09:36 +08:00
CH58x_BLEInit();
HAL_Init();
GAPRole_CentralInit();
Central_Init();
#if DEBUG == Debug_UART0
2024-12-03 11:11:30 +08:00
GPIOA_SetBits(GPIO_Pin_14);
GPIOPinRemap(ENABLE, RB_PIN_UART0);
GPIOA_ModeCfg(GPIO_Pin_15, GPIO_ModeIN_PU);
GPIOA_ModeCfg(GPIO_Pin_14, GPIO_ModeOut_PP_5mA);
UART0_DefInit();
2024-12-07 17:09:36 +08:00
#elif DEBUG == Debug_UART1
GPIOB_SetBits(GPIO_Pin_9);
GPIOA_ModeCfg(GPIO_Pin_8, GPIO_ModeIN_PU);
GPIOA_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA);
UART1_DefInit();
#elif DEBUG == Debug_UART3
BSP_UART3_Init();
2024-12-03 11:11:30 +08:00
#endif
2024-12-07 17:09:36 +08:00
BSP_UART1_Init();//BT UART
logDebug("test log debug\n");
2024-12-11 20:03:50 +08:00
BSP_FLASH_Init();
2024-12-03 11:11:30 +08:00
Main_Circulation();
}
/******************************** endfile @ main ******************************/