Broke out the CC2420 SFD interrupt into a separate file to allow easier overloading with project-specific files
This commit is contained in:
parent
4a1a823a49
commit
e3fed27f4a
4 changed files with 115 additions and 35 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)$Id: cc2420-arch.c,v 1.4 2009/04/02 22:39:29 joxe Exp $
|
||||
* @(#)$Id: cc2420-arch.c,v 1.5 2009/12/05 19:42:56 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
|
@ -39,8 +39,7 @@
|
|||
#include "dev/cc2420.h"
|
||||
|
||||
#ifdef CONF_SFD_TIMESTAMPS
|
||||
uint16_t sfd_start_time;
|
||||
uint16_t sfd_end_time;
|
||||
#include "cc2420-arch-sfd.h"
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -54,24 +53,6 @@ cc24240_port1_interrupt(void)
|
|||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
|
||||
#ifdef CONF_SFD_TIMESTAMPS
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* SFD interrupt for timestamping radio packets */
|
||||
interrupt(TIMERB1_VECTOR)
|
||||
cc24240_timerb1_interrupt(void)
|
||||
{
|
||||
int tbiv;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
/* always read TBIV to clear IFG */
|
||||
tbiv = TBIV;
|
||||
if(SFD_IS_1) {
|
||||
sfd_start_time = TBCCR1;
|
||||
} else {
|
||||
sfd_end_time = TBCCR1;
|
||||
}
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc2420_arch_init(void)
|
||||
|
@ -82,18 +63,7 @@ cc2420_arch_init(void)
|
|||
P4DIR |= BV(CSN) | BV(VREG_EN) | BV(RESET_N);
|
||||
|
||||
#ifdef CONF_SFD_TIMESTAMPS
|
||||
/* Need to select the special function! */
|
||||
P4SEL = BV(SFD);
|
||||
|
||||
/* start timer B - 32768 ticks per second */
|
||||
TBCTL = TBSSEL_1 | TBCLR;
|
||||
|
||||
/* CM_3 = capture mode - capture on both edges */
|
||||
TBCCTL1 = CM_3 | CAP | SCS;
|
||||
TBCCTL1 |= CCIE;
|
||||
|
||||
/* Start Timer_B in continuous mode. */
|
||||
TBCTL |= MC1;
|
||||
cc2420_arch_sfd_init();
|
||||
#endif
|
||||
|
||||
SPI_DISABLE(); /* Unselect radio. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue