Пример #1
0
void  BSP_Init(void)
{
	Key_Init();
	LED_Init();
	//MyLCD_Init();
  Touch_Init();
  SysTick_Init();
}
Пример #2
0
void PF_init()
{
  LED_Init();
  _channel = 1;
  _toggle = 0;
  IR_DDR |= (1<<IR_PIN_DD);
  IR_PORT &= ~(1<<IR_PIN);
}
Пример #3
0
/*----------------------------------------------------------------------------
  Main: Initialize and start RTX Kernel
 *---------------------------------------------------------------------------*/
int main (void) {

	LED_Init();                           /* Initialize LEDs                   */

  t_ledOn  = osThreadCreate(osThread(ledOn),  NULL);  /* start task 'ledOn'  */
  t_ledOff = osThreadCreate(osThread(ledOff), NULL);  /* start task 'ledOff' */
  osDelay(osWaitForever);
}
Пример #4
0
/*初始化*/
void SYSTEM_Init(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);//中断优先组
	GetDeviceSerialID();
	LED_Init();
//	BEEP_Init();
	SysTick_Config(SystemCoreClock / 1000);
}
Пример #5
0
 int main(void)
 { 
	u16 i,rxlen;
	u16 lenx;
	u8 key=0XFF;
	u8 upload=0;
	delay_init();	    	 //延时函数初始化	  
	uart_init(38400);	 	//串口初始化为9600
	USART2_Init(38400);	//初始化串口2
	LED_Init();				//初始化与LED连接的硬件接口
	KEY_Init();				//初始化与LED连接的硬件接口
   LCD_Init();				//初始化LCD
 	POINT_COLOR=RED;
	LCD_ShowString(30,20,200,16,16,"ALIENTEK STM32 ^_^");	
	LCD_ShowString(30,40,200,16,16,"NE0-6M GPS TEST");	
	LCD_ShowString(30,60,200,16,16,"[email protected]");
	LCD_ShowString(30,80,200,16,16,"KEY0:Upload NMEA Data SW");   	 										   	   
   	LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:OFF");   
	if(Ublox_Cfg_Rate(1000,1)!=0)	//设置定位信息更新速度为1000ms,顺便判断GPS模块是否在位. 
	{
   		LCD_ShowString(30,120,200,16,16,"NEO-6M Setting...");
		while((Ublox_Cfg_Rate(1000,1)!=0)&&key)	//持续判断,直到可以检查到NEO-6M,且数据保存成功
		{
			USART2_Init(9600);				//初始化串口2波特率为9600(EEPROM没有保存数据的时候,波特率为9600.)
	  		Ublox_Cfg_Prt(38400);			//重新设置模块的波特率为38400
			USART2_Init(38400);				//初始化串口2波特率为38400 
			Ublox_Cfg_Tp(1000000,100000,1);	//设置PPS为1秒钟输出1次,脉冲宽度为100ms	    
			key=Ublox_Cfg_Cfg_Save();		//保存配置  
		}	  					 
	   	LCD_ShowString(30,120,200,16,16,"NEO-6M Set Done!!");
		delay_ms(500);
		LCD_Fill(30,120,30+200,120+16,WHITE);//清除显示 
	}
	while(1) 
	{		
		delay_ms(1);
		if(USART2_RX_STA&0X8000)		//接收到一次数据了
		{
			rxlen=USART2_RX_STA&0X7FFF;	//得到数据长度
			for(i=0;i<rxlen;i++)USART1_TX_BUF[i]=USART2_RX_BUF[i];	   
 			USART2_RX_STA=0;		   	//启动下一次接收
			USART1_TX_BUF[i]=0;			//自动添加结束符
			GPS_Analysis(&gpsx,(u8*)USART1_TX_BUF);//分析字符串
			Gps_Msg_Show();				//显示信息	
			if(upload)printf("\r\n%s\r\n",USART1_TX_BUF);//发送接收到的数据到串口1
 		}
		key=KEY_Scan(0);
		if(key==KEY0_PRES)
		{
			upload=!upload;
			POINT_COLOR=RED;
			if(upload)LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:ON ");
			else LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:OFF");
 		}
		if((lenx%500)==0)LED0=!LED0; 	    				 
		lenx++;	
	}											    
}	
Пример #6
0
void GPIO_LED(void)
{
    SystemInit();

	LED_Init();
    while (1) {
        demo();
    }
}
static void rt_thread_entry_led2(void* parameter)
{
  LED_Init();  
  while (1)
  {  
    LEDTog(LED2);        
    rt_thread_delay(RT_TICK_PER_SECOND/3);        
  }
}
Пример #8
0
 int main(void)
 {
	u8 key;
	u16 i=0;
	u8 datatemp[SIZE];
 	SystemInit();
	delay_init(72);	     //延时初始化
	NVIC_Configuration();
 	uart_init(9600);
 	LED_Init();
 	KEY_Init();
	LCD_Init();
	AT24CXX_Init();		//IIC初始化 
	POINT_COLOR=RED;//设置字体为蓝色	   
	LCD_ShowString(60,50,"Mini STM32");	
	LCD_ShowString(60,70,"IIC TEST");	
	LCD_ShowString(60,90,"[email protected]");
	LCD_ShowString(60,110,"2011/1/1");			 
	while(AT24CXX_Check())//检测不到24c02
	{
		LCD_ShowString(60,130,"24C02 Check Failed!");
		delay_ms(500);
		LCD_ShowString(60,130,"Please Check!      ");
		delay_ms(500);
		LED0=!LED0;//DS0闪烁
	}
	LCD_ShowString(60,130,"24C02 Ready!");
	//显示提示信息
	LCD_ShowString(60,150,"KEY0:Write KEY2(WK_UP):Read");

	POINT_COLOR=BLUE;//设置字体为蓝色	  
	while(1)
	{
		key=KEY_Scan();
		if(key==1)//KEY0按下,写入24C02
		{
			LCD_Fill(0,170,239,319,WHITE);//清除半屏    
 			LCD_ShowString(60,170,"Start Write 24C02....");
			AT24CXX_Write(0,(u8*)TEXT_Buffer,SIZE);
			LCD_ShowString(60,170,"24C02 Write Finished!");//提示传送完成
		}
		if(key==3)//KEY_UP按下,读取字符串并显示
		{
 			LCD_ShowString(60,170,"Start Read 24C02.... ");
			AT24CXX_Read(0,datatemp,SIZE);
			LCD_ShowString(60,170,"The Data Readed Is:  ");//提示传送完成
			LCD_ShowString(60,190,datatemp);//显示读到的字符串
		}
		i++;
		delay_ms(10);
		if(i==20)
		{
			LED0=!LED0;//提示系统正在运行	
			i=0;
		}		   
	}
 }
Пример #9
0
void start_task(void *pdata)
{	
	
	OS_CPU_SR cpu_sr = 0;
	pdata = pdata;
	u8 err;
	delay_init(168);

	USART1_Init();//初始化
	LED_Init();
	BEEP_Init();

	pringf("Hello world\n");

	OS_ENTER_CRITICLE();	//进入临界区 无法被中断打断

	//创建系统定时器
	pTmrLed = OSTmrCreate(	0,//dly 计时前的延迟
				OS_TMR_CFG_TICKS_PER_SEC/2,//周期 宏本身表示1s
				OS_TMR_OPT_PERIODIC,//周期模式
				(OS_TMR_CALLBACK)LedTmrCallback,
				NULL,
				NULL,
				&err
				);//定时器时间到了 自动调用回调函数
	pTmrBeep = OSTmrCreate(	0,
				OS_TMR_CFG_TICKS_PER_SEC/2,
				OS_TMR_OPT_PERIODIC,
				(OS_TMR_CALLBACK)BeepTmrCallback,
				NULL,
				NULL,
				&err
				);

	//启动定时器
	if( OSTmrStart(pTmrLED,&err) == OS_TRUE )
	{
		printf("LED TMR Start.\n");
	}
	else
		printf("LED TMR Fail.\n");

	if( OSTmrStart(pTmrBeep,&err) == OS_TRUE )
	{
		printf("BEEP TMR Start.\n");
	}
	else
		printf("BEEP TMR Fail.\n");
	

	OS_EXIT_CRITICLE();		//退出临界区 可以被中断打断

	while(1)//一直延时 等待程序运行
		OSTimeDlyHMSM(0,0,0,500);
	

}
Пример #10
0
 int main(void)
 {	
	delay_init();	    	 //延时函数初始化	
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);// 设置中断优先级分组2
	LED_Init();		  	//初始化与LED连接的硬件接口
	OSInit();   
 	OSTaskCreate(start_task,(void *)0,(OS_STK *)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO );//创建起始任务
	OSStart();	
 }
Пример #11
0
//外部中断初始化程序
//初始化PE2~4,PA0为中断输入.
void EXTIX_Init(void)
{
	NVIC_InitTypeDef   NVIC_InitStructure;
	EXTI_InitTypeDef   EXTI_InitStructure;
	
	LED_Init();
  
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);//使能SYSCFG时钟
	
 
	SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource2);//PE2 连接到中断线2
	SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource3);//PE3 连接到中断线3
	SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE, EXTI_PinSource4);//PE4 连接到中断线4
	SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);//PA0 连接到中断线0
	
  /* 配置EXTI_Line0 */
  EXTI_InitStructure.EXTI_Line = EXTI_Line0;//LINE0
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;//中断事件
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //上升沿触发 
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;//使能LINE0
  EXTI_Init(&EXTI_InitStructure);//配置
	
	/* 配置EXTI_Line2,3,4 */
	EXTI_InitStructure.EXTI_Line = EXTI_Line2 | EXTI_Line3 | EXTI_Line4;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;//中断事件
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //下降沿触发
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;//中断线使能
  EXTI_Init(&EXTI_InitStructure);//配置
 
	NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;//外部中断0
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;//抢占优先级0
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;//子优先级2
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//使能外部中断通道
  NVIC_Init(&NVIC_InitStructure);//配置
	
	NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;//外部中断2
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x03;//抢占优先级3
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;//子优先级2
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//使能外部中断通道
  NVIC_Init(&NVIC_InitStructure);//配置
	
	
	NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn;//外部中断3
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02;//抢占优先级2
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;//子优先级2
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//使能外部中断通道
  NVIC_Init(&NVIC_InitStructure);//配置
	
	
	NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;//外部中断4
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;//抢占优先级1
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;//子优先级2
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;//使能外部中断通道
  NVIC_Init(&NVIC_InitStructure);//配置
	   
}
Пример #12
0
int main(void)
{
	LED_Init(LED_2 | LED_3);
	Beep_Init();
	SysTick_Init(1, SYSTICK_MS);
	LED_On(LED_2 | LED_3);
	Usart_Init();
	//Beep_On();
	SysTick_Delay(200, SYSTICK_MS);
	//Beep_Off();
	LED_Off(LED_2 | LED_3);
	Key_Init(KEY_S1 | KEY_S2 | KEY_S3 | KEY_S4);
	Keyboard_Init();
	//LCD_Init();	
	ADS1118_Init();
  while(1) 
	{		 
		
		printf("准备完毕 开始转换!\n");
		ADS1118_CS_Reset();
		while(!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_6));
	    ConversionValue = ADS1118_Read(count);//8283  
		ADS1118_CS_Set();
        printf(" The  Value is 0X%08x ,%08d\n",ConversionValue,ConversionValue);
		ad=	ConversionValue*4.096/32768;
		printf("AD=%fV\n",ad);
		SysTick_Delay(1000, SYSTICK_MS);	
//		Keyboard_Loop();
//		//LCD_Clear(Color_White);
//		//LCD_Set_ForeColor(Color_Red);  	
//		//if(Keyboard_Scan() == KEYBOARD_S1) { LCD_Show_String(30,50,200,16,16, "Key Board Test");	}
//		if(Keyboard_Detect(KEYBOARD_S1, KEYBOARD_DOWN)) { printf("S1\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S2, KEYBOARD_DOWN)) { printf("S2\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S3, KEYBOARD_DOWN)) { printf("S3\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S4, KEYBOARD_DOWN)) { printf("S4\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S5, KEYBOARD_DOWN)) { printf("S5\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S6, KEYBOARD_DOWN)) { printf("S6\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S7, KEYBOARD_DOWN)) { printf("S7\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S8, KEYBOARD_DOWN)) { printf("S8\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S9, KEYBOARD_DOWN)) { printf("S9\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S10, KEYBOARD_DOWN)) { printf("S10\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S11, KEYBOARD_DOWN)) { printf("S11\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S12, KEYBOARD_DOWN)) { printf("S12\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S13, KEYBOARD_DOWN)) { printf("S13\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S14, KEYBOARD_DOWN)) { printf("S14\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S15, KEYBOARD_DOWN)) { printf("S15\r\n"); }
//		if(Keyboard_Detect(KEYBOARD_S16, KEYBOARD_DOWN)) { printf("S16\r\n"); }
//		//LCD_Set_ForeColor(Color_Green);  
//		//LCD_Show_String(30,70,200,16,16, "TFT-LCD test");	
//		//LCD_Set_ForeColor(Color_Blue);  
//		//LCD_Show_String(30,90,200,16,16, "www.doflye.net");
//		//LCD_Draw_Circle(100,180,20);	
//		//SysTick_Delay(1000, SYSTICK_MS);	

	} 
}
Пример #13
0
int main(void)
{
	LED_Init();
	//KEY_Init();
	Create_Page_Table();
	Start_mmu();
	EINT0_2_11_init();
	while(1);
	return 1;
}
Пример #14
0
/**
* @brief  USBD_USR_Init
*         Displays the message on LCD for host lib initialization
* @param  None
* @retval None
*/
void USBD_USR_Init(void)
{
  /* Initialize LEDs */
  LED_Init();

  LLIO_Init(115200);


  printf("\r\n\r\nUSB Device Library v1.1.0\r\n");
}
int main(void) {

    LED_Init();

    SysTick_Config(SystemCoreClock/1000);

    while(1) {}

    return 0;
}
Пример #16
0
 int main(void)
 {
	u8 key;
	u8 i=0;	
	SystemInit();
	delay_init(72);	     //延时初始化
	NVIC_Configuration();
 	uart_init(9600);
 	LED_Init();
 	KEY_Init();
	LCD_Init();

	POINT_COLOR=RED;//设置字体为蓝色	   
	LCD_ShowString(60,50,"Mini STM32");	
	LCD_ShowString(60,70,"TOUCH TEST");	
	LCD_ShowString(60,90,"[email protected]");
	LCD_ShowString(60,110,"2011/1/1");	
	LCD_ShowString(60,130,"Press KEY0 to Adjust");	
	Touch_Init();
	delay_ms(1500);
	Load_Drow_Dialog();	  
	while(1)
	{	
	 	key=KEY_Scan();
		if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下
		{
			Pen_Int_Set(0);//关闭中断
			do
			{
				Convert_Pos();
				Pen_Point.Key_Sta=Key_Up;
				if(Pen_Point.X0>216&&Pen_Point.Y0<16)Load_Drow_Dialog();//清除
				else 
				{
					Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0);//画图	    
					GPIOC->ODR|=1<<1;    //PC1 上拉	   
				}
			}while(PEN==0);//如果PEN一直有效,则一直执行
			Pen_Int_Set(1);//开启中断
		}else delay_ms(10);
		if(key==1)//KEY0按下,则执行校准程序
		{
			LCD_Clear(WHITE);//清屏
		    Touch_Adjust();  //屏幕校准 
			Save_Adjdata();	 
			Load_Drow_Dialog();
		}
		i++;
		if(i==20)
		{
			i=0;
			LED0=!LED0;
		}
	};	   
 }
Пример #17
0
void GPIO_LED(void)
{
    TSB_WD_MOD_WDTE = 0U;
    TSB_WD->CR = 0x000000B1;
    SystemInit();

	LED_Init();
    while (1) {
        demo();
    }
}
Пример #18
0
void led0Task(void *pdata)
{
	LED_Init();
	while(1)
	{
		OPEN_LED0();
		Delay(100000);
		CLOSE_LED0();
		Delay(100000);
	}
}
Пример #19
0
int main()
{
    LED_Init();

    SW_INT_INIT();

    while(1)
    {
        __WFI();
    }

}
Пример #20
0
int app_main(void)
#endif
{
  HAL_Init();
  LED_Init();

  while (1)
  {
    HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN);
    HAL_Delay(1000);
  }
}
Пример #21
0
void BlinkLEDExample()
{
	LED_Init();

	LED_Off(LED0|LED1|LED2|LED3);

	while (1)
	{
		LED_Toggle(LED0|LED1|LED2|LED3);
		cpu_delay_ms(1000, FOSCRC);
	}
}
Пример #22
0
static void init_io () {

  /* Configure LEDs */
  LED_Init();

  /* Configure buttons */
  KBD_Init();

  /* Configure serial output */
  SER_Init();

}
Пример #23
0
int main(void)
{
    uint8_t i;
    uint32_t cnt = 0;
    CAN_InitTypeDef CAN_InitStruct1;
    //使用CAN时 CoreClock 必须是96M
    SystemClockSetup(ClockSource_EX50M,CoreClock_96M);
    DelayInit();
    LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
    UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
    DisplayCPUInfo();
    //配置CAN初始化信息
    CAN_InitStruct1.CANxMap = CAN1_TX_PE24_RX_PE25;      //PE24 PE25引脚
    CAN_InitStruct1.CAN_BaudRateSelect = CAN_SPEED_125K; //125K 波特率
    CAN_InitStruct1.FilterEnable = ENABLE;              //不使用过滤ID功能
    CAN_Init(&CAN_InitStruct1);
	  
    //配置接收信息
    CAN_RxMsg1.MBIndex = CAN_MB1;                  //接收邮箱使用CAN_MB1
    CAN_RxMsg1.DLC = 8;                            //最多接收8个字节 一帧
    CAN_RxMsg1.Id = 7;                             //接收ID
    CAN_EnableReceiveMB(CAN1, &CAN_RxMsg1);        //使能接收邮箱
    //配置发送数据
    CAN_TxMsg1.Id = 10;                          //发送ID 10
    CAN_TxMsg1.DLC = 8;                          //每帧8字节
    CAN_TxMsg1.IDE = CAN_IDE_Standard;           //标准数据帧
    CAN_TxMsg1.RTR = CAN_RTR_Data;               //数据帧
    CAN_TxMsg1.MBIndex = CAN_MB2;                //使用邮箱0
		
    //写入测试数据  
    memcpy(CAN_TxMsg1.Data, "12345678", CAN_TxMsg1.DLC);
    while(1) 
    { 
        if (CAN_Receive(CAN1, &CAN_RxMsg1) == TRUE)
        {
					  //如果接收成功 打印接收数据
            UART_printf("ID:0x%x\r\n",CAN_RxMsg1.Id);
            UART_printf("Data: ");
            for(i = 0; i < CAN_RxMsg1.DLC; i++)
            {
                UART_printf("0x%x ", CAN_RxMsg1.Data[i]);
            }
            UART_printf("\r\n");
        }
        cnt++; 
        //发送
        if(cnt == 1000000)
        {
            CAN_Transmit(CAN1, &CAN_TxMsg1);
            cnt = 0;
        }				
    }
}
Пример #24
0
int main(void)
{
	u8 key,fontok=0; 
   	Stm32_Clock_Init(9);	//系统时钟设置
	delay_init(72);			//延时初始化
	uart_init(72,115200); 	//串口1初始化 
	LCD_Init();				//初始化液晶 
	LED_Init();         	//LED初始化	 
	KEY_Init();				//按键初始化	 
	usmart_dev.init(72);	//usmart初始化	
 	USART2_Init(36,115200);	//初始化串口2 
	TP_Init();				//初始化触摸屏
	mem_init(SRAMIN);		//初始化内部内存池	    
 	exfuns_init();			//为fatfs相关变量申请内存  
  	f_mount(0,fs[0]); 		//挂载SD卡 
	key=KEY_Scan(0);  
	if(key==KEY_RIGHT)		//强制校准
	{
		LCD_Clear(WHITE);	//清屏
		TP_Adjust();  		//屏幕校准 
		TP_Save_Adjdata();	  
		LCD_Clear(WHITE);	//清屏
	}
	fontok=font_init();		//检查字库是否OK
	if(fontok||key==KEY_DOWN)//需要更新字库				 
	{
		LCD_Clear(WHITE);		   	//清屏
 		POINT_COLOR=RED;			//设置字体为红色	   	   	  
		LCD_ShowString(60,50,200,16,16,"ALIENTEK STM32");
		while(SD_Initialize())		//检测SD卡
		{
			LCD_ShowString(60,70,200,16,16,"SD Card Failed!");
			delay_ms(200);
			LCD_Fill(60,70,200+60,70+16,WHITE);
			delay_ms(200);		    
		}								 						    
		LCD_ShowString(60,70,200,16,16,"SD Card OK");
		LCD_ShowString(60,90,200,16,16,"Font Updating...");
		key=update_font(20,110,16,0);//从SD卡更新
		while(key)//更新失败		
		{			 		  
			LCD_ShowString(60,110,200,16,16,"Font Update Failed!");
			delay_ms(200);
			LCD_Fill(20,110,200+20,110+16,WHITE);
			delay_ms(200);		       
		} 		  
		LCD_ShowString(60,110,200,16,16,"Font Update Success!");
		delay_ms(1500);	
		LCD_Clear(WHITE);//清屏	       
	}  
	sim900a_test();
}
Пример #25
0
int main(void)
{
	u32 i = 0, j = 0;
	float distance = 0.0;
	float light = 0.0;
	
	//SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
	//SysTick_Config(72);
	
	delay_init();	    	   //延时函数初始化
	NVIC_Configuration();  //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
	TIM_Config();
	uart_init(115200);	 	 //串口初始化为115200
	KEY_Init();
 	LED_Init();			       //LED端口初始化
	SW_I2C_Init();
//	HW_I2C2_Init();

	Single_WriteI2C(SlaveAddress1, 0x02, 0x72);

	while(1)
	{
		distance = 0.0;
		light = 0.0;
		
		delay_ms(400);			
		
		// ks103测距
		if (distance_flag)
		{
			distance = Read_KS10X_Data(SlaveAddress1, 0xb0);
			printf("-%04d- distance: %04.3f  cm\r\n", i++, distance);
		}
		
		// ks103测光强
		if (light_flag)
		{
			light = Read_KS10X_Data(SlaveAddress1, 0xa0);
			printf("-%04d- light: %04.3f  cd\r\n", j++, light);
		}
		
		if (distance_flag | distance_flag)
			LED0 = !LED0;
/*
		t1 = tick;
		delay2x(1000);  // 延时167us
		t2 = tick;

		printf("time: %d us\r\n", t2 - t1);
*/
	}
}
Пример #26
0
int main(void) {
    //DEVCFG1bits.FCKSM = 0;
    int c = 0;
    // for (c = 0; c < 100000; c++) {
    //     Nop();
    //  }

    BOARD_Init();

    //INTEnableSystemMultiVectoredInt();
    //SERIAL_Init();
    //DEVCFG1bits.FCKSM
    //TIMERS_Init();
    //    SYSKEY = 0;
    //    SYSKEY = 0xAA996655;
    //    SYSKEY = 0x556699AA;
    //    OSCCONbits.FRCDIV = 0b111;
    //    OSCConfig(OSC_FRC_PLL, OSC_PLL_MULT_20, OSC_PLL_POST_1, OSC_PB_DIV_1);



    LED_Init(LED_BANK1);
    LED_SetBank(LED_BANK1,~2);
    //while(1);
    //SERIAL_Init();
    //LATBbits.LATB7 = 1;
    TIMERS_Init();
    unsigned char count=0;
    //while (1) {
    // LATCbits.LATC3 ^= 1;
    //}

    
    printf("Hello World\r\n");
    while (1) {
        if (!IsTimerActive(0)) {
            // LATCbits.LATC5 ^= 1;
            //LATBbits.LATB9 ^= 1;
            InitTimer(0, 500);
            printf("TOP: %X\r\n",count);
            LED_SetBank(LED_BANK1,count);
            count++;
            
        }
        if (!IsReceiveEmpty()) {
            //LATBbits.LATB8 ^= 1;
            printf("%c", GetChar());
        }
    }

    while (1);
}
Пример #27
0
void init()
{
	delay_init();
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
	LED_Init();	//LED端口初始化 	
	TIM3_Int_Init(719,4999);  //主中断0.03
	uart_init(9600);	 //串口初始化为115200,读上位机数据
	uart2_init(9600);  //读陀螺仪数据
	uart3_init(9600);
	ENCODE_Init();  //编码器初始化
	queue_init(&rx_queue);	
	basketballbot.Control_ID = Global;
}
Пример #28
0
void Config_Init()
{
	//初始化LED
	LED_Init();
	//初始化串口引脚
	USART2_Init();
	USART6_Init();
	//初始化屏幕引脚
	LCD_GPIOInit();
	//配置uart
	USART_Config();
	
}
Пример #29
0
Файл: main.c Проект: yguo89/RTOS
// *************** SetupHardware *************** 
// Configures the necessary hardware for the board 
// Inputs: none
// Outputs: none
void SetupHardware( void )
{
    /* If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
       a workaround to allow the PLL to operate reliably. */
    if( DEVICE_IS_REVA2 )
    {
        SysCtlLDOSet( SYSCTL_LDO_2_75V );
    }
	
	/* Set the clocking to run from the PLL at 50 MHz */
	SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
	                SYSCTL_XTAL_8MHZ );								
					
    // Initialize GPIO driver
	GPIO_InitTasks();

    // Initialize uartstdio for UART0, which is used for communicating over USB and
	// debugging. UART0 uses port A pins 0-1.
	#if ENABLE_UART_PRINTF	 	
	UART_Init();
	#endif	
	
	// Initialize SPI0 for sensor ports
	// SPI1 is initialized by transceiver code
	// XXX What does EEPROM_Init() do besides SPI_Init(0)?
	EEPROM_Init();
			 	 
	// Enable Buttons and/or LEDs depending on target board
#if EVAL_BOARD == 1 
	GPIO_Init( BUTTON_PORT, UP_BUTTON|DOWN_BUTTON|LEFT_BUTTON|RIGHT_BUTTON|SEL_BUTTON,
			   GPIO_DIR_MODE_IN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU ); 
	LED_Init(DEBUG_LED);
#else				
	LED_Init(LED1);
	LED_Init(LED2);	
	LED_Init(LED3);	
	LED_Init(LED4);	
#endif
}
Пример #30
0
int main(void)
{	
	delay_init();	    	 //延时函数初始化	  
	LED_Init();		  	//初始化与LED连接的硬件接口
    TIM2_Int_Init(9,2);         //DMA 触发时钟
    Dac1_Init();
    uart_init(115200);
   	while(1)
	{  
        delay_ms(500);
        LED1=!LED1;
	} 
}