Пример #1
0
void mirf_set_RADDR(uint8_t * adr) 
// Sets the receiving address
{
    mirf_CE_lo;
    mirf_write_register(RX_ADDR_P0,adr,5);
    mirf_CE_hi;
}
Пример #2
0
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
void mirf_config(void) {
  // Set RF channel
  mirf_config_register(RF_CH, mirf_CH);

  // air data rate: 1Mbps
  mirf_config_register(RF_SETUP, 0x6);

  // Set length of incoming payload 
  mirf_config_register(RX_PW_P0, mirf_PAYLOAD);
  mirf_config_register(RX_PW_P1, mirf_PAYLOAD);  
  // Set RADDR and TADDR(autoack)
  /* mirf_write_register(RX_ADDR_P0, &tx_addr[0], 5); */
  /* mirf_write_register(TX_ADDR, &tx_addr[0], 5); */
  /* mirf_write_register(RX_ADDR_P1, &rx_addr[0], 5); */
#ifdef TRANSMIT_MODE
  mirf_write_register(RX_ADDR_P0, &addr[0], 5);
  mirf_write_register(TX_ADDR, &addr[0], 5);
#endif
#ifdef RECEIVE_MODE
  mirf_CE_hi
  mirf_write_register(RX_ADDR_P1, &addr[0], 5);
#endif
  mirf_config_register(EN_AA, 0x03);

  // Enable RX_ADDR_P0 address matching since we also enable auto acknowledgement
  /* mirf_config_register(EN_RXADDR, 1<<ERX_P1); */
  mirf_config_register(EN_RXADDR, 1<<ERX_P0 | 1<<ERX_P1);
//from enrf24
  //mirf_config_register(FEATURE, 0x04);  // enable dynamic payloads length
  //mirf_config_register(DYNPD, 0x03); // enable dynamic payload length data pipe 0 and data pipe 1

  /* mirf_config_register(SETUP_RETR, 0x7F); */
  /* PMODE = TXMODE; // Start in transmitting mode */
  /* TX_POWERUP;     // Power up in transmitting mode */
  //frankalicious: testing
  /* PMODE = RXMODE; // Start in transmitting mode */
  /* RX_POWERUP; */
#ifdef TRANSMIT_MODE
  PMODE = TXMODE; // Start in transmitting mode
  TX_POWERUP;     // Power up in transmitting mode
#endif
#ifdef RECEIVE_MODE
  PMODE = RXMODE; // Start in transmitting mode
  RX_POWERUP;     // Power up in transmitting mode
#endif

}
Пример #3
0
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
void mirf_config(void) {
	// Set RF channel
	mirf_config_register(RF_CH, mirf_CH);

	// Set length of incoming payload 
	mirf_config_register(RX_PW_P0, mirf_PAYLOAD);
	
	// Set RADDR and TADDR
	mirf_write_register(RX_ADDR_P0, TADDR, 5);
	mirf_write_register(TX_ADDR, TADDR, 5);
	
	// Enable RX_ADDR_P0 address matching since we also enable auto acknowledgement
	mirf_config_register(EN_RXADDR, 1<<ERX_P0);

	PMODE = TXMODE; // Start in transmitting mode
	TX_POWERUP;     // Power up in transmitting mode
}
Пример #4
0
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
void mirf_config(void) {
  // Set RF channel
  mirf_config_register(RF_CH, mirf_CH);

  // Set length of incoming payload 
  mirf_config_register(RX_PW_P0, mirf_PAYLOAD);

  // Set RADDR and TADDR
  mirf_write_register(RX_ADDR_P0, RADDR, 5);
  mirf_write_register(TX_ADDR, TADDR, 5);
  
  // Only enable RX_ADDR_P0 address matching
  mirf_config_register(EN_RXADDR, (1<<ERX_P0));
  mirf_config_register(EN_AA, 0x00);

  // Start receiver 
  PMODE = RXMODE; // Start in receiving mode
  RX_POWERUP;     // Power up in receiving mode
}
Пример #5
0
// Sets the important registers in the MiRF module and powers the module
// in receiving mode
void mirf_config(void) {
	// Set RF channel
	mirf_config_register(RF_CH, mirf_CH);
	
	// Set length of incoming payload 
	mirf_config_register(RX_PW_P0, mirf_PAYLOAD);
	mirf_config_register(RX_PW_P1, mirf_PAYLOAD);
	
	// Set auto retransmit delay to 500uS and leave auto retransmit count to 3
	mirf_config_register(SETUP_RETR, (1<<4) | 3);
	
	// Set RADDR and TADDR
	mirf_write_register(RX_ADDR_P0, TADDR, 5);
	mirf_write_register(RX_ADDR_P1, RADDR, 5);
	mirf_write_register(TX_ADDR, TADDR, 5);
	
	// Enable RX_ADDR_P0 and RX_ADDR_P1 address matching since we also enable auto acknowledgement
	mirf_config_register(EN_RXADDR, (1<<ERX_P0 | 1<<ERX_P1));
	
	// Power up in transmitter mode
	TX_POWERUP;
}
Пример #6
0
/*******************************************************************************
 * Sets the transmitting address                                               *
 ******************************************************************************/
void mirf_set_TADDR(uint8_t * adr)
{
    mirf_write_register(TX_ADDR, adr,5);
}
Пример #7
0
/*******************************************************************************
 * Sets the receiving address                                                  *
 ******************************************************************************/
void mirf_set_RADDR(uint8_t * adr)
{
    mirf_CE_lo;
    mirf_write_register(RX_ADDR_P0,adr,5);
    mirf_CE_hi;
}
Пример #8
0
void mirf_set_TADDR(uint8_t * adr)
// Sets the transmitting address
{
    mirf_write_register(TX_ADDR, adr,5);
}