/* add user code begin Header */ /** ************************************************************************** * @file main.c * @brief main program ************************************************************************** * Copyright notice & Disclaimer * * The software Board Support Package (BSP) that is made available to * download from Artery official website is the copyrighted work of Artery. * Artery authorizes customers to use, copy, and distribute the BSP * software and its related documentation for the purpose of design and * development in conjunction with Artery microcontrollers. Use of the * software is governed by this copyright notice and the following disclaimer. * * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES, * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS, * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS, * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * ************************************************************************** */ /* add user code end Header */ /* Includes ------------------------------------------------------------------*/ #include "includes.h" /* private includes ----------------------------------------------------------*/ /* add user code begin private includes */ /* add user code end private includes */ /* private typedef -----------------------------------------------------------*/ /* add user code begin private typedef */ /* add user code end private typedef */ /* private define ------------------------------------------------------------*/ /* add user code begin private define */ /* add user code end private define */ /* private macro -------------------------------------------------------------*/ /* add user code begin private macro */ /* add user code end private macro */ /* private variables ---------------------------------------------------------*/ /* add user code begin private variables */ /* add user code end private variables */ /* private function prototypes --------------------------------------------*/ /* add user code begin function prototypes */ void bsp_init(void); /* add user code end function prototypes */ /* private user code ---------------------------------------------------------*/ /* add user code begin 0 */ /* add user code end 0 */ /** * @brief main function. * @param none * @retval none */ int main(void) { /* add user code begin 1 */ /* add user code end 1 */ /* system clock config. */ wk_system_clock_config(); /* config periph clock. */ wk_periph_clock_config(); /* add user code begin 2 */ bsp_init(); LCD_Init(); LCD_Dump_Init(); drv_nvm_init(); TaskInit(); timer_init(); InitMenuUI(); BSP_HT7178PowerEnable (1); BSP_ChargerEnable(1); CurrUIProcress = IdleProcess; /* add user code end 2 */ while(1) { if(!powon) { app_adc_in1_scan_part(4); app_adc_in1_scan_part(7); } /* add user code begin 3 */ Power_Key_Scan(); LCD_Dump_Poll(); rt_thread_delay(1); /* add user code end 3 */ } } /* add user code begin 4 */ void bsp_init(void) { /* init debug function. */ wk_debug_config(); /* nvic config. */ wk_nvic_config(); /* timebase config. */ wk_timebase_init(); /* TMR6 1ms 硬件定时器(独立于 SysTick 的时间基准) */ wk_tmr6_1ms_init(); /* init dma1 channel1 */ /* config dma channel transfer parameter */ /* user need to modify define values DMAx_CHANNELy_XXX_BASE_ADDR and DMAx_CHANNELy_BUFFER_SIZE in at32xxx_wk_config.h */ /* init usart2 function. */ wk_usart2_init(); /* init uart4 function. */ wk_uart4_init(); /* init spi1 function. */ wk_spi1_init(); /* init adc1 function. */ wk_adc1_init(); /* init acc function. */ wk_acc_init(); /* init usbfs function. */ wk_usbfs_init(); /* init gpio function. */ wk_gpio_config(); } /* add user code end 4 */