Exemple #1
0
/**
  * Main function
  */
int main (void) {

	osKernelInitialize();                     /* initialize CMSIS-RTOS          */

	HAL_Init();                               /* Initialize the HAL Library     */

	SystemClock_Config();                     /* Configure the System Clock     */

	/* User codes goes here*/
	// initializeLED_IO();                       /* Initialize LED GPIO Buttons    */
	// start_Thread_LED();                       /* Create LED thread              */

	init_acc_kstate(0.01f, 0.1f, 0.0f, 0.1f, 0.0f);
	init_temp_kstate(0.005f, 0.05f, 0.0f, 5.0f, 0.0f);

	MAIL_CONTROLLER_init_mailboxes();
	ConfigureADC();
	accelerometer_init();
	LED_init_io();
	KP_init();

	TIM3_init();
	TIM4_init();

	MAIL_CONTROLLER_start_thread();
	LED_start_thread();
	temperature_start_thread();
	accelerometer_start_thread();
	KEYPAD_start_thread();
	/* User codes ends here*/

	osKernelStart();                          /* start thread execution         */

}
Exemple #2
0
/*
 * 函数名:main
 * 描述  :主函数
 * 输入  :无
 * 输出  :无
 */
int main(void)
{
	
	SystemInit();
	USART1_init();//USART初始化
	SPI1_init()	;//SPI初始化
	DW1000_init();//DW1000初始化
	TIM3_init(); //定时器3初始化
	EXTI_init();  //外部中断初始化
	TIM4_init();
	RX_mode_enable();
	printf("RX!\r\n");

	
	
	printf("**********************************\r\n");

	

	while (1)
	{
		;
	}      
	
}
Exemple #3
0
void init_all(void)
{
	GPIO_init();
	DAC_DMA_init();
	P24_init();
	vdisplay_init();
	codec_init();
	codec_ctrl_init();
	TIM6_init();			/* Initialize timer */
	TIM3_init();			/* interrupts last... */
	TIM4_init();
}
Exemple #4
0
int main(void) {
	u8 dip_config;
	SystemInit();

	// Init USB for Master Nodes
	#if defined(RX4) || defined(RX5) || defined(RX6)
	Set_System();
	Set_USBClock();
	USB_Interrupts_Config();
	USB_Init();
	#endif

	dip_config = Read_DIP_Configuration();

	// USART1初始化,波特率115200,单次8比特,无奇偶校验,1停止位:用于上位机下发命令
	USART1_init(dip_config);
	// 串口监听
	TIM4_init();
	//InitMPU6050();
	SPI1_init();
	TIM3_init();
	GPIO_Configuration();

	DW1000_init(dip_config);
	EXTI_init();

	#ifdef TX
	TIM2_init(); // LS Poll Cycle
	#endif

	RX_mode_enable();
	DEBUG1(("=====Init Done, with DIP config: %02X=====\r\n", dip_config));

	while(1) {
		;
	}
}
Exemple #5
0
//==================================================================================
//==================================================================================
//==================================================================================
int main()
{
	bool ver = 0;
	uint8_t cnt_link = 0;
	
	PLL_init();
	GPIO_init();
	TIM1_init();
	TIM2_init();
	TIM3_init();
	UART_init();
	WDT_init();
	EEPROM_init();
	
	SysTick_Config(SystemCoreClock/800);//~10 ms
	
	
	time.t1=5;
	time.t2=5;
	time.t3=5;
	time.t4=5;
	delay_ms(100);
	
	Segment[0]=0xFF;
	Segment[1]=0xFF;
	Segment[2]=0xFF;
	Segment[3]=0xFF;
	Segment[4]=0xFF;
	Segment[5]=0xFF;
	Segment[6]=0x7F;
	ALARM_ON;
	delay_ms(100);
	ALARM_OFF;
	delay_ms(1000);
	//
	//
	
  while(1)
	{
		if( TX_st )
		{
			TX_st = 0;
			
			if( cnt_link < LINK_COUNT )
			{
				link_PKBA();
				++cnt_link;
			}
			else
			{
				PKDU.error = true;
				cnt_link = 0;
			}
		}
		
		if( RX_ok && !PKDU.error )
		{
			uint8_t cnt_byte = 0, sum = 0;
			
			while( cnt_byte < RX_FRAME_SIZE )
			{
				sum += ArrayRX_PKBA[cnt_byte];
				++cnt_byte;
			}
			sum += 0xAA;
			
			if( !sum )
			{
				StatusPKBA.reg0 = ArrayRX_PKBA[0];
				StatusPKBA.reg1 = ArrayRX_PKBA[1];
				StatusPKBA.Error = (ArrayRX_PKBA[3]<<8) | ArrayRX_PKBA[2];
				StatusPKBA.RabReg0 = ArrayRX_PKBA[4];
				StatusPKBA.UGen = (ArrayRX_PKBA[6]<<8) | ArrayRX_PKBA[5];
				StatusPKBA.IGen = (ArrayRX_PKBA[8]<<8) | ArrayRX_PKBA[7];
				StatusPKBA.DT = ArrayRX_PKBA[9];
				StatusPKBA.DM = ArrayRX_PKBA[10];
				StatusPKBA.TM = ArrayRX_PKBA[11];
				StatusPKBA.NDiz = (ArrayRX_PKBA[13]<<8) | ArrayRX_PKBA[12];
				StatusPKBA.TBapEx = ArrayRX_PKBA[14];
				StatusPKBA.TBapIn = ArrayRX_PKBA[15];
				StatusPKBA.Led1 = ArrayRX_PKBA[16];
				StatusPKBA.Led2 = ArrayRX_PKBA[17];

				if( !ver )
				{
					ver = true;
					show_ver();
					delay_ms( 1500 );
					Segment[ 0 ] = 0;
					Segment[ 1 ] = 0;
					Segment[ 2 ] = 0;
					Segment[ 3 ] = 0;
					Segment[ 4 ] = 0;
				}
			cnt_link=0;
			}
			RX_ok=0;
		}
		
		__nop();
		
		Set_Error();
		
		if(!PKDU.error)
			ShowParam();
		
		if((PKDU.StatusKN>>4)&1)
		{
			maska_err = 0;
			StatusPKBA.Error=0;
			PKDU.error=false;
			cnt_link = 0;
		}
		
		if(((PKDU.StatusKN>>5)&1) && ((PKDU.StatusKN>>6)&1))
		{
			Segment[0] = 0xFF;
			Segment[1] = 0xFF;
			Segment[2] = 0xFF;
			Segment[3] = 0xFF;
			Segment[4] = 0xFF;
			Segment[5] = 0xFF;
			Segment[6] = 0x7F;
			
			while(((PKDU.StatusKN>>5)&1)&&((PKDU.StatusKN>>6)&1))
				IWDG_ReloadCounter();
		}
		
		ControlZvonok();
		
		write_hour();
		IWDG_ReloadCounter();
	}
}