pic_rf_2401a.c File Reference

Pic Nordic nrf2401a routines. More...

#include "pic_rf_2401a.h"
#include "pic_serial.h"
#include <stdlib.h>

Include dependency graph for pic_rf_2401a.c:

Go to the source code of this file.

Functions

void pic_rf_init (rf_config *my_config)
 Initialise nrf2401a chip with config.
void pic_rf_quick_init (char *my_config, uns8 my_channel, bit my_receive_on)
 Initialise nrf2401a chip with quick config.
void pic_rf_receive (uns8 *data, uns8 bytes_to_receive)
 Receive data from nrf2401a.
void pic_rf_send_byte (uns8 b)
 Internal routine to send a byte to nrf2401a.
void pic_rf_send_bytes (char *bytes, uns8 num_bytes)
 Internal routine to send bytes to nrf2401a.
void pic_rf_set_channel (uns8 channel)
 Change channel on the nrf2401a.
void pic_rf_set_mode (uns8 mode)
 Set rf mode to transmit or receive.
void pic_rf_setup ()
 Setup ports and pins for communication with nrf2401a.
void pic_rf_transmit (char *data, uns8 bytes_to_transmit)
 Transmit data from nrf2401a.


Detailed Description

Nordic nrf2401a routines

Ian Harris 2008 imharris [at] gmail.com

Released under the "do whatever you like with this but if you use it send me an email" license. Oh, and if it breaks, you get to keep both pieces.

Definition in file pic_rf_2401a.c.


Function Documentation

void pic_rf_init ( rf_config my_config  ) 

Sends the configuration to the Nordic nrf2401a chip ready to begin communication. This routine assumes you have already set my_config to the correct values.

Definition at line 62 of file pic_rf_2401a.c.

void pic_rf_quick_init ( char *  my_config,
uns8  my_channel,
bit  my_receive_on 
)

While the usual pic_rf_init() routine is excellent when you want to programatically change the 2401a config, if you're only doing this once (at the start) then it's likely you're burning a lot of instructions (154 words on a PIC16 device) just to send some bytes of config out to the 2401a. If you know your config in advance, then you can just send the byte-stream config using this routine. Use the nrf2401a_config.pl script in the tools directory to generate this string.

Definition at line 41 of file pic_rf_2401a.c.

void pic_rf_receive ( uns8 *  data,
uns8  bytes_to_receive 
)

Having been notified that there is data available, call this routine to clock the data in from the nrf2401a.

!pic_rf_chip_enable(0); // save power

pic_rf_chip_enable(1); // turn chip back on

Definition at line 109 of file pic_rf_2401a.c.

References clear_pin, kill_interrupts, make_input, set_pin, test_pin, and uns8.

void pic_rf_send_byte ( uns8  b  ) 

Internal routine to send a byte to the nrf2401a. Generally you shouldn't need to use this, see pic_rf_transmit instead

See also:
pic_rf_transmit

Definition at line 20 of file pic_rf_2401a.c.

Referenced by pic_rf_init(), pic_rf_quick_init(), pic_rf_read_register(), pic_rf_send_bytes(), pic_rf_send_bytes_inline(), pic_rf_send_command(), and pic_rf_set_channel().

Here is the caller graph for this function:

void pic_rf_send_bytes ( char *  bytes,
uns8  num_bytes 
)

Internal routine to send bytes to the nrf2401a. Generally you shouldn't need to use this, see pic_rf_transmit instead

See also:
pic_rf_transmit

Definition at line 33 of file pic_rf_2401a.c.

Referenced by pic_rf_init().

Here is the caller graph for this function:

void pic_rf_set_channel ( uns8  channel  ) 

Reclocks the essential config to change the current channel used by the nrf2401a.

Definition at line 178 of file pic_rf_2401a.c.

void pic_rf_set_mode ( uns8  mode  ) 

Pass RECEIVE_MODE or TRANSMIT_MODE to change current mode. Generally, you shouldn't need to call this routine. The library assumes you want to receive until you transmit, in which case it switches automatically to transmit mode and back to receive afterwards.

Definition at line 157 of file pic_rf_2401a.c.

Referenced by pic_rf_transmit().

Here is the caller graph for this function:

void pic_rf_setup (  ) 

Set up ports and pins to correct input/output for communication with Nordif nrf2401a

Definition at line 200 of file pic_rf_2401a.c.

void pic_rf_transmit ( char *  data,
uns8  bytes_to_transmit 
)

Changes the mode to TRANSMIT_MODE, clocks data into the nrf2401a and hits the shockburst button.

Definition at line 133 of file pic_rf_2401a.c.

References kill_interrupts, make_output, pic_rf_chip_enable, pic_rf_send_bytes_inline(), pic_rf_set_mode(), RECEIVE_MODE, rf_current_mode_receive, TRANSMIT_MODE, and uns8.

Referenced by pkt_send_packet().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Fri May 16 12:19:07 2008 for Pic Pack by  doxygen 1.5.5