Songw Jiang / nRF24L01P

Dependents:   RC_Green Drown RC_RX

Revision:
7:fa987efaeecd
Parent:
6:a0e847d59312
Child:
8:62cdaa369cfa
--- a/nRF24L01P.cpp	Tue Dec 10 02:14:48 2019 +0000
+++ b/nRF24L01P.cpp	Sat Dec 14 11:56:11 2019 +0000
@@ -7,14 +7,9 @@
 uint8_t RX_ADDRESS[5]= {0x00,0x00,0x00,0x00,0x08};
 int Nrf_Erro=0;
 int ledtick;
-int init_time=0;
-
-void nRF24L01P::powerUp(){}
 
 void nRF24L01P::setTransferSize(int TransSize ){}
 
-void nRF24L01P::setReceiveMode(){}
-
 void nRF24L01P::setRxAddress(int RxAdd)
 {
 	RX_ADDRESS[4]=RxAdd&0xFF;
@@ -23,11 +18,6 @@
 {
 	TX_ADDRESS[4]=TxAdd&0xFF;
 }
-void nRF24L01P::enable()
-{
-	NRF24L01_Init(40,1);
-}
-
 
 uint8_t nRF24L01P::NRF_Read_Reg(uint8_t reg)
 {
@@ -130,8 +120,6 @@
     spi_.frequency(9000000); 
     spi_.format(8,0); 
     wait_us(4);    // Wait for Power-on reset
-    NRF24L01_Init(40,1);
-    NRF24L01_Check();
 }
 
 
@@ -161,9 +149,9 @@
 }
 void nRF24L01P::NRF24L01_Init(uint8_t Chanal,uint8_t Mode)
 {
-	init_time++;
-	if(init_time>=3)
-		return;
+//	init_time++;
+//	if(init_time>=3)
+//		return;
 	ce_=0;
 	ledtick=0;
 	NRF_Write_Reg(FLUSH_TX,0xff);
@@ -182,7 +170,8 @@
 		NRF_Write_Reg(NRF_WRITE_REG + CONFIG,0x0E);
 	else if(Mode==RX)
 		NRF_Write_Reg(NRF_WRITE_REG + CONFIG,0x0F);
-	
+	nIRQ_.mode(PullDown);
+	nIRQ_.rise(&nRF_Analysis);
 	ce_=1;
 }
 void nRF24L01P::NRF24L01_IRQ(void)
@@ -227,4 +216,3 @@
 		Nrf_Erro = 1;
 	}
 }
-