#include "pic_rf_2401a.h"
#include "pic_serial.h"
#include <stdlib.h>
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. |
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.
void pic_rf_init | ( | rf_config * | my_config | ) |
Initialise nRF24L01 chip with 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 | |||
) |
Receive data from nRF24L01.
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.
void pic_rf_send_byte | ( | uns8 | b | ) |
Clock a byte into the nRF24L01.
Internal routine to send a byte to the nrf2401a. Generally you shouldn't need to use this, see pic_rf_transmit instead
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(), pic_rf_send_command_single(), and pic_rf_set_channel().
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
Definition at line 33 of file pic_rf_2401a.c.
References pic_rf_send_byte(), and uns8.
Referenced by pic_rf_init().
void pic_rf_set_channel | ( | uns8 | channel | ) |
Receive data from nRF24L01 (inline).
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().
void pic_rf_setup | ( | ) |
Setup ports and pins for communication with nRF24L01.
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 to transmit mode, clocks data into the nRF2401A and hits the shockburst button. Returns to receive mode when finished.
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().