mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-13 19:43:44 +00:00
NRF CE
This commit is contained in:
parent
942dec81c7
commit
8150504ea0
@ -224,9 +224,13 @@ struct PPM_Parameters
|
|||||||
#ifdef XMEGA
|
#ifdef XMEGA
|
||||||
#define NRF_CSN_on
|
#define NRF_CSN_on
|
||||||
#define NRF_CSN_off
|
#define NRF_CSN_off
|
||||||
|
#define NRF_CE_on
|
||||||
|
#define NRF_CE_off
|
||||||
#else
|
#else
|
||||||
#define NRF_CSN_on PORTB |= _BV(0) //D8
|
#define NRF_CSN_on PORTB |= _BV(0) //D8
|
||||||
#define NRF_CSN_off PORTB &= ~_BV(0) //D8
|
#define NRF_CSN_off PORTB &= ~_BV(0) //D8
|
||||||
|
#define NRF_CE_on
|
||||||
|
#define NRF_CE_off
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
#ifdef XMEGA
|
#ifdef XMEGA
|
||||||
|
@ -130,7 +130,6 @@ uint8_t pkt[MAX_PKT];//telemetry receiving packets
|
|||||||
// Callback
|
// Callback
|
||||||
typedef uint16_t (*void_function_t) (void);//pointer to a function with no parameters which return an uint16_t integer
|
typedef uint16_t (*void_function_t) (void);//pointer to a function with no parameters which return an uint16_t integer
|
||||||
void_function_t remote_callback = 0;
|
void_function_t remote_callback = 0;
|
||||||
static void CheckTimer(uint16_t (*cb)(void));
|
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
void setup()
|
void setup()
|
||||||
|
@ -160,7 +160,7 @@ void NRF24L01_SetPower()
|
|||||||
void NRF24L01_SetTxRxMode(enum TXRX_State mode)
|
void NRF24L01_SetTxRxMode(enum TXRX_State mode)
|
||||||
{
|
{
|
||||||
if(mode == TX_EN) {
|
if(mode == TX_EN) {
|
||||||
NRF_CSN_off;
|
NRF_CE_off;
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
||||||
| (1 << NRF24L01_07_TX_DS)
|
| (1 << NRF24L01_07_TX_DS)
|
||||||
| (1 << NRF24L01_07_MAX_RT));
|
| (1 << NRF24L01_07_MAX_RT));
|
||||||
@ -168,11 +168,11 @@ void NRF24L01_SetTxRxMode(enum TXRX_State mode)
|
|||||||
| (1 << NRF24L01_00_CRCO)
|
| (1 << NRF24L01_00_CRCO)
|
||||||
| (1 << NRF24L01_00_PWR_UP));
|
| (1 << NRF24L01_00_PWR_UP));
|
||||||
delayMicroseconds(130);
|
delayMicroseconds(130);
|
||||||
NRF_CSN_on;
|
NRF_CE_on;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (mode == RX_EN) {
|
if (mode == RX_EN) {
|
||||||
NRF_CSN_off;
|
NRF_CE_off;
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // reset the flag(s)
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // reset the flag(s)
|
||||||
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0F); // switch to RX mode
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x0F); // switch to RX mode
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, (1 << NRF24L01_07_RX_DR) //reset the flag(s)
|
||||||
@ -183,12 +183,12 @@ void NRF24L01_SetTxRxMode(enum TXRX_State mode)
|
|||||||
| (1 << NRF24L01_00_PWR_UP)
|
| (1 << NRF24L01_00_PWR_UP)
|
||||||
| (1 << NRF24L01_00_PRIM_RX));
|
| (1 << NRF24L01_00_PRIM_RX));
|
||||||
delayMicroseconds(130);
|
delayMicroseconds(130);
|
||||||
NRF_CSN_on;
|
NRF_CE_on;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NRF24L01_WriteReg(NRF24L01_00_CONFIG, (1 << NRF24L01_00_EN_CRC)); //PowerDown
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, (1 << NRF24L01_00_EN_CRC)); //PowerDown
|
||||||
NRF_CSN_off;
|
NRF_CE_off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ void NRF24L01_Reset()
|
|||||||
NRF24L01_FlushTx();
|
NRF24L01_FlushTx();
|
||||||
NRF24L01_FlushRx();
|
NRF24L01_FlushRx();
|
||||||
NRF24L01_Strobe(0xff); // NOP
|
NRF24L01_Strobe(0xff); // NOP
|
||||||
NRF24L01_ReadReg(0x07);
|
NRF24L01_ReadReg(NRF24L01_07_STATUS);
|
||||||
NRF24L01_SetTxRxMode(TXRX_OFF);
|
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||||
delayMicroseconds(100);
|
delayMicroseconds(100);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user