nrf24l01.c File Reference

nRF24L01 handler functions. This is for MOD-NRF24Lx (MOD-NRF24LR or MOD-NRF24LS) extension board. You should connect P3.0 to CSN, P3.1 to MOSI, P3.2 to MISO, P3.3 to CLK and P1.6 to CE using the EXT connector of MSP430-449STK2. More...

#include <msp430xG461x.h>
#include "nrf24l01.h"
#include "time.h"
#include "lcd.h"

Include dependency graph for nrf24l01.c:

Go to the source code of this file.

Defines

#define CSN_TIME   2
#define CE_HIGH_TIME   10000

Functions

void Delay (unsigned long a)
void CSN_HIGH (void)
void CSN_LOW (void)
void CE_HIGH (void)
void CE_LOW (void)
unsigned char SPI_SendByte (unsigned char data)
unsigned char SPI_Send_command_with_ADDR (unsigned char cmd, unsigned char addr, unsigned char data_byte)
unsigned char SPI_Send_command_without_ADDR (unsigned char cmd, unsigned char data_byte)
void NRF_init (void)
void NRF_send (uint8_t byte)
void NRF_prepareForReceive ()
bool_t NRF_receive (uint8_t *const byte)

Variables

unsigned char RX_ADDRESS_P0 [5] = {5,6,7,8,9}
 Receive the packets with following address.
unsigned char RX_ADDRESS_P1 [5] = {0,1,2,3,4}
 Receive the packets with following address.
unsigned char TX_ADDRESS [5] = {5,6,7,8,9}
 Transmit packets with following address.
unsigned char ADDRESS [5]
unsigned char status


Detailed Description

nRF24L01 handler functions. This is for MOD-NRF24Lx (MOD-NRF24LR or MOD-NRF24LS) extension board. You should connect P3.0 to CSN, P3.1 to MOSI, P3.2 to MISO, P3.3 to CLK and P1.6 to CE using the EXT connector of MSP430-449STK2.

Author:
Peter Ivanov, Olimex Ltd.

Definition in file nrf24l01.c.


Function Documentation

void CE_HIGH ( void   ) 

Internal function to enable chip nRF24L01 (switch chip enable line to high).

Definition at line 67 of file nrf24l01.c.

void CE_LOW ( void   )  [inline]

Internally used function to disable chip nRF24L01 (switch chip enable line to low).

Definition at line 76 of file nrf24l01.c.

void CSN_HIGH ( void   )  [inline]

Internally used function to switch /CS line to high.

Definition at line 50 of file nrf24l01.c.

void CSN_LOW ( void   ) 

Internally used function to switch /CS line to low.

Definition at line 58 of file nrf24l01.c.

void Delay ( unsigned long  a  ) 

Software delay.

Parameters:
a Number of loop.

Definition at line 42 of file nrf24l01.c.

void NRF_prepareForReceive (  ) 

After sending a byte you may set the device to RX mode.

Definition at line 321 of file nrf24l01.c.

bool_t NRF_receive ( uint8_t *const  byte  ) 

Receive one byte from the air via chip nRF24L01. Addresses are hardcoded:

See also:
RX_ADDRESS_P0 RX_ADDRESS_P1 TX_ADDRESS
Parameters:
byte The data byte to receive.
Returns:
TRUE: if byte succesfully received. FALSE: if no input data.

Definition at line 337 of file nrf24l01.c.

void NRF_send ( uint8_t  byte  ) 

Send one byte to the air via chip nRF24L01. Addresses are hardcoded:

See also:
RX_ADDRESS_P0 RX_ADDRESS_P1 TX_ADDRESS
Parameters:
byte The data byte to send.

Definition at line 260 of file nrf24l01.c.

unsigned char SPI_Send_command_with_ADDR ( unsigned char  cmd,
unsigned char  addr,
unsigned char  data_byte 
)

Internally used function to send command to the chip NRF24L01 via SPI.

Parameters:
cmd Command to send. Example: R_REGISTER
addr Address to send. Example: RX_ADDR_P0
data_byte Data byte to send. This data byte will not be sent in some cases! Check source code!
Returns:
Status.

Definition at line 103 of file nrf24l01.c.

unsigned char SPI_SendByte ( unsigned char  data  ) 

Internally used function to transmit and receive a byte via SPI channel.

Parameters:
data One byte to send.
Returns:
Received byte.

Definition at line 87 of file nrf24l01.c.


Generated on Sun Dec 9 17:17:10 2007 for Sample MSP430-4619LCD Project by  doxygen 1.5.1