Beispiel #1
0
/***********************************************************************************
* @fn      halRfDisableRxInterrupt
*
* @brief   Clear and disable RX interrupt.
*
* @param   none
*
* @return  none
*/
void halRfDisableRxInterrupt(void)
{
    // Clear the exception and the IRQ
    CLEAR_EXC_RX_FRM_DONE();
    halDigioIntClear(&pinRadio_GPIO0);
    halDigioIntDisable(&pinRadio_GPIO0);
}
Beispiel #2
0
/***********************************************************************************
* @fn          cc2520_init
*
* @brief       Initialise cc2520 datastructures. Sets channel, short address and
*              PAN id in the chip and configures interrupt on packet reception
*
*              txState - file scope variable that keeps tx state info
*              rxi - file scope variable info extracted from the last incoming
*                    frame
*
* @return      none
*/
uint8_t
cc2520_init()
{    
	pConfig.panId = PAN_ID;
    pConfig.channel = RF_CHANNEL;
    pConfig.ackRequest = TRUE;
    pConfig.myAddr = NODE_ADDR;
    
	cc2520_interfaceInit();	// initialize the rest of the interface. 
	
	cc2520_spiInit();		// initialize spi.
	
    if (cc2520_config() == FAILED)
        return FAILED;

	// initialize the ring buffer
//	bufInit(&rxBuffer, ringBuffer, 512);

    _disable_interrupts();

    rxi.pPayload   = NULL;

    txState.receiveOn = TRUE;
    txState.frameCounter = 0;

    // Set channel
    cc2520_setChannel(pConfig.channel);

    // Write the short address and the PAN ID to the CC2520 RAM
    cc2520_setShortAddr(pConfig.myAddr);
    cc2520_setPanId(pConfig.panId);

    // if security is enabled, write key and nonce
    #ifdef SECURITY_CCM
    //basicRfSecurityInit(pConfig);
    #endif

    // Set up receive interrupt (received data or acknowlegment)
    P2IES &= ~(CC2520_INT_PIN); // Set rising edge
    P2IFG &= ~(CC2520_INT_PIN); 
    P2IE |= CC2520_INT_PIN;

    // Clear the exception
    CLEAR_EXC_RX_FRM_DONE();
    
    // Enable general interrupts
    _enable_interrupts();
	
	// And enable reception on cc2520
	cc2520_receiveOn();
	
	memset(eth_tx_buf, 0xFF, 6);
  	memset(&eth_tx_buf[6], 0, 6);
 	eth_tx_buf[12] = 0x80;
  	eth_tx_buf[13] = 0x9a;
	
	return SUCCESS;
}
Beispiel #3
0
/***********************************************************************************
* @fn      halRfRxInterruptConfig
*
* @brief   Enable RX interrupt.
*
* @param   none
*
* @return  none
*/
void halRfRxInterruptConfig(ISR_FUNC_PTR pfISR)
{
    halDigioIntSetEdge(&pinRadio_GPIO0, HAL_DIGIO_INT_RISING_EDGE);
    halDigioIntConnect(&pinRadio_GPIO0, pfISR);
    halDigioIntEnable(&pinRadio_GPIO0);

    // And clear the exception
    CLEAR_EXC_RX_FRM_DONE();
}
Beispiel #4
0
/***********************************************************************************
* @fn      halRfRxInterruptConfig
*
* @brief   Enable RX interrupt.
*
* @param   none
*
* @return  none
*/
void halRfRxInterruptConfig(ISR_FUNC_PTR pfISR)
{
//	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
//	GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_1);				/* Default pin is Push-pull.*/
	GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);
	GPIOIntTypeSet(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_RISING_EDGE);	/* Rising edge is active.*/
	GPIOPortIntRegister(GPIO_PORTD_BASE, pfISR);
	GPIOPinIntEnable(GPIO_PORTD_BASE, GPIO_PIN_0);
	
    CLEAR_EXC_RX_FRM_DONE();										/* And clear the exception.*/
}
Beispiel #5
0
/***********************************************************************************
* @fn      halRfDisableRxInterrupt
*
* @brief   Clear and disable RX interrupt.
*
* @param   none
*
* @return  none
*/
void halRfDisableRxInterrupt(void)
{
    // Clear the exception and the IRQ
    CLEAR_EXC_RX_FRM_DONE();
#if 0 // POOH
    halDigioIntClear(&pinRadio_GPIO0);
    halDigioIntDisable(&pinRadio_GPIO0);
#else
    EXTI_ClearITPendingBit(GPIO_EXTI_Line_RF_GPIO0);
    CC2520_GPIO_0_Interrupt_Setting(DISABLE);
#endif
}
Beispiel #6
0
/***********************************************************************************
 * @fn      halRfDisableRxInterrupt
 *
 * @brief   Clear and disable RX interrupt.
 *
 * @param   none
 *
 * @return  none
 */
void halRfDisableRxInterrupt(void) {
	CLEAR_EXC_RX_FRM_DONE();
	extChannelDisable(&EXTD1, 7);
}
Beispiel #7
0
void halRfRxInterruptConfig(void (*func)(void)) {
	// Set function pointer
	gpio0_func = func;

	CLEAR_EXC_RX_FRM_DONE();
}