2 \author Travis Goodspeed
3 \brief NordicRF Register Interface
6 //Higher level left to client application.
18 //Weird HOPE badge wiring. This was a fuckup.
19 //BIT0 should be SS, but in point of fact it is IRQ.
20 //BIT4 is actually SS, BIT5 is CE.
23 //This could be more accurate.
24 //Does it ever need to be?
30 //! Set up the pins for NRF mode.
37 //Begin a new transaction.
43 //! Read and write an NRF byte.
44 unsigned char nrftrans8(unsigned char byte){
45 register unsigned int bit;
46 //This function came from the NRF Wikipedia article.
49 for (bit = 0; bit < 8; bit++) {
50 /* write MOSI on trailing edge of previous clock */
59 /* read MISO on trailing edge */
68 //! Handles a Nordic RF command.
69 void nrfhandle(unsigned char app,
74 //Raise !SS to end transaction, just in case we forgot.
79 //PEEK and POKE might come later.
82 P5OUT&=~SS; //Drop !SS to begin transaction.
84 cmddata[i]=nrftrans8(cmddata[i]);
85 P5OUT|=SS; //Raise !SS to end transaction.
89 case PEEK://Grab NRF Register
90 P5OUT&=~SS; //Drop !SS to begin transaction.
91 nrftrans8(0|(NRF_R_REGISTER & cmddata[0])); //000A AAAA
93 cmddata[i]=nrftrans8(cmddata[i]);
94 P5OUT|=SS; //Raise !SS to end transaction.
98 case POKE://Poke NRF Register
99 P5OUT&=~SS; //Drop !SS to begin transaction.
100 nrftrans8(0|(NRF_W_REGISTER & cmddata[0])); //001A AAAA
102 cmddata[i]=nrftrans8(cmddata[i]);
103 P5OUT|=SS; //Raise !SS to end transaction.
104 txdata(app,verb,len);