コード例 #1
0
ファイル: nrf24.c プロジェクト: brunexgeek/indiana
uint8_t nrf24_initialize()
{
    nrf24_setupPins();
    nrf24_ce_digitalWrite(LOW);
    nrf24_csn_digitalWrite(HIGH);
    nrf24_config(0, 32);

    return NRF24_OK;
}
コード例 #2
0
/* init the hardware pins */
void nrf24_init() 
{
    nrf24_setupPins();
    nrf24_ce_digitalWrite(LOW);
    nrf24_csn_digitalWrite(HIGH);    

    #if defined (__AVR_ATmega328P__)
        /* Set SS pin output */
        DDRB |= (1<<2); 

        /* Set SPI peripheral @Fosc/2 */
        SPCR = (1<<SPE)|(1<<MSTR);
        SPSR |= (1<<SPI2X);
    #endif

}
コード例 #3
0
ファイル: nrf24.c プロジェクト: bmswgnp/cheep-sync
/* init the hardware pins */
void nrf24_init() 
{
    nrf24_setupPins();
    nrf24_ce_digitalWrite(LOW);
    nrf24_csn_digitalWrite(HIGH);
    nrf24_ce_digitalWrite(HIGH);
    nrf24_config(2,32);
    //nrf24_readRegister(CONFIG,&tx1,1);
    //tx1=0;
    //nrf24_configRegister(RF_CH,2);
    //nrf24_readRegister(EN_AA,&tx1,1);
    //tx1=0;
    nrf24_configRegister(RF_CH,2);
    nrf24_readRegister(RF_CH,&tx1,1);
    tx1=0;
    nrf24_readRegister(CONFIG,&tx1,1);
    tx1=0;
    nrf24_readRegister(RX_ADDR_P0,&readData,5);
    tx1=0;
    nrf24_readRegister(RF_SETUP,&tx1,1);
    tx1=0;
    nrf24_readRegister(TX_ADDR,&readData,5);
    tx1=0;
    nrf24_configRegister(SETUP_AW,2);
    //nrf24_readRegister(SETUP_AW,&tx1,1);
    //nrf24_configRegister(DYNPD,0x00);
    //nrf24_configRegister(FEATURE,0x00);
    //nrf24_tx_address(&tx_address11);
    //copy_paste();

//	nrf_cmd(0x20, 0x12);	//on, no crc, int on RX/TX done
//	nrf_cmd(0x21, 0x00);	//no auto-acknowledge
//	nrf_cmd(0x22, 0x00);	//no RX
//	nrf_cmd(0x23, 0x02);	//5-byte address
//	nrf_cmd(0x24, 0x00);	//no auto-retransmit
//	nrf_cmd(0x26, 0x06);	//1MBps at 0dBm
//	nrf_cmd(0x27, 0x3E);	//clear various flags
//	nrf_cmd(0x3C, 0x00);	//no dynamic payloads
//	nrf_cmd(0x3D, 0x00);	//no features
//	nrf_cmd(0x31, 32);	//always RX 32 bytes
//	nrf_cmd(0x22, 0x01);	//RX on pipe 0

}
コード例 #4
0
/* init the hardware pins */
void nrf24_init() 
{
    nrf24_setupPins();
    nrf24_ce_digitalWrite(LOW);
    nrf24_csn_digitalWrite(HIGH);    
}