#include "led.h"
#include "delay.h"
#include "sys.h"
#include "usart.h"
#include "lcd.h"
#include "key.h"
#include "spi.h"
#include "24l01.h"   
//ALIENTEK Mini STM32开发板范例代码24
//无线通信实验  
//技术支持：www.openedv.com
//广州市星翼电子科技有限公司  

 int main(void)
 {
  u8 a;	 
	u8 tmp_buf[33];      //定义数组
	delay_init();	    	 //延时函数初始化	
	NVIC_Configuration();	 
	uart_init(9600);	 	//串口初始化为9600
	LED_Init();		  		//初始化与LED连接的硬件接口
	LCD_Init();			   	//初始化LCD 	
 	KEY_Init();				//按键初始化
 	NRF24L01_Init();    	//初始化NRF24L01  
 	POINT_COLOR=RED;//设置字体为红色 
	LCD_ShowString(60,50,200,16,16,"Mini STM32");	
	LCD_ShowString(60,70,200,16,16,"NRF24L01 TEST");	
	LCD_ShowString(60,90,200,16,16,"ATOM@ALIENTEK");
	LCD_ShowString(60,110,200,16,16,"2014/3/12");		  
 	while(NRF24L01_Check())	//检查NRF24L01是否在位.	
	{
		delay_ms(100);
	}								   
	LCD_ShowString(60,130,200,16,16,"NRF24L01 OK");
 	LCD_Fill(10,150,240,166,WHITE);//清空上面的显示		  
 	POINT_COLOR=BLUE;//设置字体为蓝色	   
	LCD_ShowString(60,150,200,16,16,"NRF24L01 RX_Mode");	
	LCD_ShowString(60,170,200,16,16,"Received DATA:");	
	NRF24L01_RX_Mode();		  
	   while(1)
		{	  		    		    				 
			if(NRF24L01_RxPacket(tmp_buf)==0)//一旦接收到信息,则显示出来.
			{
				LCD_ShowString(0,190,239,32,16,tmp_buf);
				a=(tmp_buf[0]-'0')*100+(tmp_buf[1]-'0')*10+(tmp_buf[2]-'0');
				a=a;
        LED0=!LED0;
        LED1=!LED1; 				
			}				    
		}	
}


























