Files
2025-09-29 16:49:49 +08:00

114 lines
2.8 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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();
}
}