#include "hy9225.h" #include "stdio.h" #include "usmart.h" #include "SysApi.h" #include "xtal.h" #include "OtaApi.h" #include "UserApi.h" #include "SpbApi.h" #include "SpbDriverApi.h" #include "FbApi.h" #include "VsyncApi.h" #include "SocApi.h" #include "OtaApi.h" #include "PvdApi.h" #include "bl_ic_config.h" #include "hy_driver.h" int main(void) { static uint8_t key_press_counter = 0; static bist_key_status3 bist_mode = BIST_KEY_MODE3_WHITE; uint16_t temp=0,temp2=0; uint16_t i,j; MAP_U16* map=(MAP_U16 *)&map_tab[0]; uint8_t head_L8; NVIC_Vector_Table_Set(NVIC_VECTTAB_FLASH,FIRMWARE_ADD); SYS_Init(); UartApi_Init(460800); Project_Message(); PVD_Init(); Fb_Init(machine.fb_init_freq,machine.fb_init_duty); Spb_Init(); Button_Init(); printf("start init ic\n"); Hydriver_Init(66,0xfff,0); I2c_Init(); Sys_Spi_Init(); VsyncApi_Init(); FbApi_Timer6Init(500); FbApi_StartDetect(); VsyncApi_StartCap(); #if 0//测试代码开关 // FbApi_StopDetect(); // FbApi_SetValue(0); fb_params.all_small_duty = FB_DUTY_LEVEL_BIG; while(1) { // Key_Detect_Process(); Test_Process(); delay_us(200); if((fb_params.all_small_duty == FB_DUTY_LEVEL_BIG) && (fb_params.sampleSickReady) && (fb_params.sickSamplePinValid)) { FbApi_FbSample(); } Spb_Broadcast(0x2f,0,(CH_SICK_INT1<<4) | (PWM<<1)); FbApi_Process(); } #endif while(1) { #if HC_FUNCTION_ADD_BIST_KEY_3 if(GPIO_Input_Pin_Data_Get(GPIOC, GPIO_PIN_14) == 0) { if(key_press_counter < 10) key_press_counter++; if(key_press_counter == 5) { bist_mode++; } if(bist_mode == BIST_KEY_MODE3_INVALID) { bist_mode = BIST_KEY_MODE3_WHITE1; } } else { key_press_counter = 0; } #endif // usmart_dev.scan(); PvdApi_Process(); Ota_Process(); #if HC_FUNCTION_ADD_BIST_KEY_3 if(VsyncCounter<1600) { //时间为1600*500US=800ms,大概6帧数据没有接收到说明数据没有发送 if(check_led_flag==1) //I2C发送命令进行行列跑 BistLightUpAllProcess2(); else Dimming_Process(); } else { if((bist_mode == BIST_KEY_MODE3_WHITE)||(bist_mode == BIST_KEY_MODE3_WHITE1)) BistLightUpAllProcess3(); else if(bist_mode == BIST_KEY_MODE3_FLASH_EVERY_CHANNEL) BistLightUpAllProcess2(); else if(bist_mode == BIST_KEY_MODE3_SINGLE_HORSE_RACE) BistLightUpAllProcess1(); } #else Dimming_Process(); #endif // FbApi_Process(); } }