Exemplo n.º 1
0
/*******************************************************************************
 * @fn     void setup_radio( uint8_t (*callback)(void) )
 * @brief  Initialize radio and register Rx Callback function
 * ****************************************************************************/
void setup_cc2500( uint8_t (*callback)(uint8_t*, uint8_t) )
{
  uint8_t initial_power = 0xFB;				// 0 dBm

  // Set-up rx_callback function
  rx_callback = callback;

  spi_setup();                         // Initialize SPI port

  cc_powerup_reset();               // Reset CCxxxx

  wait_cycles(500);  // Wait for device to reset (Not sure why this is needed)

  writeRFSettings();                        // Write RF settings to config reg
  cc_write_burst_reg( TI_CCxxx0_PATABLE, &initial_power, 1);//Write PATABLE

  cc_strobe(TI_CCxxx0_SRX);           // Initialize CCxxxx in RX mode.
                                            // When a pkt is received, it will
                                            // signal on GDO0 and wake CPU

  // Configure GDO0 port
  GDO0_PxIES |= GDO0_PIN;       // Int on falling edge (end of pkt)
  GDO0_PxIFG &= ~GDO0_PIN;      // Clear flag
  GDO0_PxIE |= GDO0_PIN;        // Enable int on end of packet

}
Exemplo n.º 2
0
uint8_t setup_cc2500(void) {

	uint8_t returnValue=0;
	uint8_t initial_power = 0xFB;				// 0 dBm
	// Set-up rx_callback function

	do
	{
		// Changed
		//spi_init();                         // Initialize SPI port

		// FIXME Add uscib0 files
		cc_powerup_reset();               // Reset CCxxxx

		// TODO implement this
		wait_cycles(500);  // Wait for device to reset (Not sure why this is needed)

		if(writeRFSettings())                        // Write RF settings to config reg
		{
			returnValue = 1; // Failed
			break;
		}

		// FIXME Add uscib0 files
		cc_write_burst_reg( TI_CCxxx0_PATABLE, &initial_power, 1);//Write PATABLE

		// FIXME Add uscib0 files

		cc_strobe(TI_CCxxx0_SIDLE);
		WAIT1_Waitms(10);
		cc_strobe(TI_CCxxx0_SFRX);      // Flush RXFIFO
		WAIT1_Waitms(10);
		cc_strobe(TI_CCxxx0_SFTX);      // Flush RXFIFO
		WAIT1_Waitms(10);




		cc_strobe(TI_CCxxx0_SRX);           // Initialize CCxxxx in RX mode.



		returnValue = cc_read_status(TI_CCxxx0_MARCSTATE);
		returnValue =0;



		// When a pkt is received, it will
		// signal on GDO0 and wake CPU

		// FIXME
		// Configure GDO0 port
	//	GDO0_PxIES |= GDO0_PIN;       // Int on falling edge (end of pkt)
	//	GDO0_PxIFG &= ~GDO0_PIN;      // Clear flag
	//	GDO0_PxIE |= GDO0_PIN;        // Enable int on end of packet
		CC_2500_SETUP_DONE = true;
	}while(0);

	return returnValue;
}