初中生
最后登录1970-1-1
在线时间 小时
注册时间2015-3-10
|
楼主 |
发表于 2015-5-5 15:49:13
|
显示全部楼层
int32_t nrf_sign = 0;
char tem_num[24] = {0};
/* 3õê¼»ˉLCD */
LCD_Init();
//LCD_Clear(0, 0, 240, 320, BACKGROUND);
/* 3õê¼»ˉsd¿¨ÎļtÏμí3£¬òòÎaoo×ÖμÄ×Ö¿a·ÅÔúáËsd¿¨àïÃæ */
Sd_fs_init();
/* 3õê¼»ˉ′®¿ú */
// USART1_Config();
/* Ïμí3¶¨ê±Æ÷ 1us ¶¨ê±3õê¼»ˉ */
SysTick_Init();
/* 3õê¼»ˉLED */
LED_GPIO_Config();
/*3õê¼»ˉ°′¼ü*/
EXTI_Key_Config();
while( DS18B20_Init());
/* ê1ÄüμçÔ′1üàíμ¥ÔaμÄê±Öó */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR , ENABLE);
//SPI_NRF_Init();
/* 3õê¼»ˉía2¿FLASH */
SPI_FLASH_Init();
//SPI_FLASH_SectorErase(0);
/* ′¥ÃtÆáIOoíÖD¶Ï3õê¼»ˉ */
Touch_Init();
//′¥ÃtÆáD£×¼
lcd_link();
/* ÏÔê¾LED¿ØÖƽçÃæí¼Æ¬ */
lcd_ui();
SPI_NRF_Init();
/* ′®¿ú13õê¼»ˉ */
USART1_Config();
/*¼ì2aNRFÄ£¿éóëMCUμÄᬽó*/
status = NRF_Check();
/*ÅD¶Ïᬽó×′ì¬*/
if(status == SUCCESS)
printf("\r\n NRFóëMCUᬽó3é1|£¡\r\n");
else
printf("\r\n NRFóëMCUᬽó꧰ü£¬ÇëÖØD¼ì2é½óÏß¡£\r\n");
while(1)
{
while(ui_sign == 1 || ui_sign == 2 || ui_sign == 3)
{
printf("\r\n Ö÷»ú¶Ë ½øèë×Ôó|′e·¢ËíÄ£ê½\r\n");
NRF_TX_Mode();
//¿aê¼·¢Ëíêy¾Y
/*status = NRF_Tx_Dat(txbuf);
//ÅD¶Ï·¢Ëí×′ì¬
switch(status)
{
case MAX_RT:
printf("\r\n Ö÷»ú¶Ë û½óêÕμ½ó|′eDÅoÅ£¬·¢Ëí′Îêy3¬1yÏT¶¨Ö죬·¢Ëí꧰ü¡£ \r\n");
break;
case ERROR:
printf("\r\n Î′ÖaÔ-òòμ¼Ö·¢Ëí꧰ü¡£ \r\n");
break;
case TX_DS:
printf("\r\n Ö÷»ú¶Ë ½óêÕμ½ ′ó»ú¶Ë μÄó|′eDÅoÅ£¬·¢Ëí3é1|£¡ \r\n");
break;
}
*/
printf("\r\n Ö÷»ú¶Ë ½øèë½óêÕÄ£꽡£ \r\n");
NRF_RX_Mode();
//μè′y½óêÕêy¾Y
/*status = NRF_Rx_Dat(rxbuf);
//ÅD¶Ï½óêÕ×′ì¬
switch(status)
{
case RX_DR:
for(i=0;i<4;i++)
{
printf("\r\n Ö÷»ú¶Ë ½óêÕμ½ ′ó»ú¶Ë ·¢ËíμÄêy¾YÎa£o%d \r\n",rxbuf[i]);
txbuf[i] =rxbuf[i];
}
break;
case ERROR:
printf("\r\n Ö÷»ú¶Ë ½óêÕ3ö′í¡£ \r\n");
break;
}*/
if((rxbuf[1] == 1) && (ui_sign == 1))
LCD_DispEnCh(170, 100, (uint8_t *)"¿a", BLUE);
else if((ui_sign == 1) && (rxbuf[1] == 0))
LCD_DispEnCh(170, 100, (uint8_t *)"1Ø", BLUE);
else if((rxbuf[2] == 1) && (ui_sign == 2))
LCD_DispEnCh(170, 100, (uint8_t *)"¿a", BLUE);
else if((ui_sign == 2) && (rxbuf[2] == 0))
LCD_DispEnCh(170, 100, (uint8_t *)"1Ø", BLUE);
else if((rxbuf[3] == 1) && (ui_sign == 3))
LCD_DispEnCh(170, 100, (uint8_t *)"¿a", BLUE);
else if((ui_sign == 3) && (rxbuf[3] == 0))
LCD_DispEnCh(170, 100, (uint8_t *)"1Ø", BLUE);
}
while(ui_sign == 4)
{
while(DS18B20_Init());
sprintf(tem_num,"%.1f ¶è",DS18B20_Get_Temp());
Lcd_GramScan( 1 );
LCD_DispEnCh(170,100,tem_num,BLUE);
}
};
}
|
|